Merge pull request #3157 from novaugust/device

Use Device.js to determine mobile editor use
This commit is contained in:
Hannah Wolfe 2014-07-01 09:04:03 +01:00
commit 14779ffe83
3 changed files with 6 additions and 2 deletions

View File

@ -509,6 +509,7 @@ var path = require('path'),
'bower_components/showdown/src/showdown.js',
'bower_components/moment/moment.js',
'bower_components/keymaster/keymaster.js',
'bower_components/device/lib/device.js',
'bower_components/jquery-ui/ui/jquery-ui.js',
'bower_components/jquery-file-upload/js/jquery.fileupload.js',
'bower_components/fastclick/lib/fastclick.js',

View File

@ -4,6 +4,7 @@
"backbone": "1.0.0",
"codemirror": "4.0.1",
"Countable": "2.0.2",
"device": "matthewhudson/device.js#5347a275b66020a0d4dfe9aad81a488f8cce448d",
"ember": "1.5.0",
"ember-data": "~1.0.0-beta.8",
"ember-load-initializers": "git://github.com/stefanpenner/ember-load-initializers.git#0.0.1",

View File

@ -1,4 +1,4 @@
/*global CodeMirror*/
/*global CodeMirror, device*/
import mobileUtils from 'ghost/utils/mobile-utils';
import createTouchEditor from 'ghost/assets/lib/touch-editor';
@ -24,7 +24,9 @@ setupMobileCodeMirror = function setupMobileCodeMirror() {
};
init = function init() {
if (mobileUtils.hasTouchScreen()) {
//Codemirror does not function on mobile devices,
// nor on any iDevice.
if (device.mobile() || (device.tablet() && device.ios())) {
$('body').addClass('touch-editor');
// make editor tabs touch-to-toggle in portrait mode