Use Device.js to determine mobile editor use

Ref #2570
- Adds new library, device.js to determine if the user is on an ios mobile
  or tablet.
This commit is contained in:
Matt Enlow 2014-06-30 12:29:36 -06:00
parent d4222ed87d
commit 3689be16a2

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