diff --git a/ghost/admin/app/routes/editor.js b/ghost/admin/app/routes/editor.js index 1d6da2fdb8..c8d8a666a7 100644 --- a/ghost/admin/app/routes/editor.js +++ b/ghost/admin/app/routes/editor.js @@ -2,16 +2,53 @@ import $ from 'jquery'; import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route'; import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd'; +import {htmlSafe} from '@ember/string'; import {run} from '@ember/runloop'; +import {inject as service} from '@ember/service'; let generalShortcuts = {}; generalShortcuts[`${ctrlOrCmd}+shift+p`] = 'publish'; export default AuthenticatedRoute.extend(ShortcutsRoute, { + feature: service(), + notifications: service(), + userAgent: service(), + classNames: ['editor'], shortcuts: generalShortcuts, titleToken: 'Editor', + setupController() { + this._super(...arguments); + + // display a warning if we detect an unsupported browser + if (this.feature.koenigEditor) { + // IE is definitely not supported and will not work at all in Ghost 2.0 + if (this.userAgent.browser.isIE) { + this.notifications.showAlert( + htmlSafe('Internet Explorer is not supported in Koenig and will no longer work in Ghost 2.0. Please switch to Ghost Desktop or a recent version of Chrome/Firefox/Safari.'), + {type: 'info', key: 'koenig.browserSupport'} + ); + } + + // edge has known issues + if (this.userAgent.browser.isEdge) { + this.notifications.showAlert( + htmlSafe('Microsoft Edge is not currently supported in Koenig. Please switch to Ghost Desktop or a recent version of Chrome/Firefox/Safari.'), + {type: 'info', key: 'koenig.browserSupport'} + ); + } + + // mobile browsers are not currently supported + if (this.userAgent.device.isMobile || this.userAgent.device.isTablet) { + this.notifications.showAlert( + htmlSafe('Mobile editing is not currently supported in Koenig. Please use a desktop browser or Ghost Desktop.'), + {type: 'info', key: 'koenig.browserSupport'} + ); + } + } + }, + actions: { save() { this._blurAndScheduleAction(function () { diff --git a/ghost/admin/package.json b/ghost/admin/package.json index 4afad821c7..f241003a84 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -93,6 +93,7 @@ "ember-svg-jar": "1.2.0", "ember-test-selectors": "1.0.0", "ember-truth-helpers": "2.0.0", + "ember-useragent": "0.6.1", "ember-wormhole": "0.5.4", "emberx-file-input": "1.2.1", "eslint": "4.19.1", diff --git a/ghost/admin/yarn.lock b/ghost/admin/yarn.lock index ff39372182..3617c94125 100644 --- a/ghost/admin/yarn.lock +++ b/ghost/admin/yarn.lock @@ -4153,6 +4153,17 @@ ember-truth-helpers@2.0.0, ember-truth-helpers@^2.0.0: dependencies: ember-cli-babel "^6.8.2" +ember-useragent@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/ember-useragent/-/ember-useragent-0.6.1.tgz#0854b3c11acf0fdd98a165fba9bf5dc76eace804" + dependencies: + broccoli-debug "^0.6.3" + broccoli-funnel "^2.0.1" + broccoli-merge-trees "^3.0.0" + ember-cli-babel "^6.6.0" + fastboot-transform "^0.1.2" + ua-parser-js "^0.7.14" + ember-weakmap@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ember-weakmap/-/ember-weakmap-3.2.0.tgz#663871d7a8bb085c5b1cedcb3fb183857990343f" @@ -4771,6 +4782,13 @@ fast-sourcemap-concat@^1.0.1: source-map-url "^0.3.0" sourcemap-validator "^1.0.5" +fastboot-transform@^0.1.2: + version "0.1.3" + resolved "https://registry.yarnpkg.com/fastboot-transform/-/fastboot-transform-0.1.3.tgz#7dea0b117594afd8772baa6c9b0919644e7f7dcd" + dependencies: + broccoli-stew "^1.5.0" + convert-source-map "^1.5.1" + faye-websocket@~0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" @@ -9901,6 +9919,10 @@ typedarray@^0.0.6, typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +ua-parser-js@^0.7.14: + version "0.7.18" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed" + uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376"