mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Koenig - Show alert for unsupported browsers
refs https://github.com/TryGhost/Ghost/issues/9724 - add `ember-useragent` package so that we can check the user agent screen for known-incompatible browsers/devices - show alerts for Edge, mobile browsers, and IE11 when accessing the editor with Koenig enabled
This commit is contained in:
parent
f673a4f19f
commit
b6f5a443d5
3 changed files with 60 additions and 0 deletions
|
@ -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 <a href="https://ghost.org/downloads/" target="_blank" rel="noopener">Ghost Desktop</a> 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 <a href="https://ghost.org/downloads/" target="_blank" rel="noopener">Ghost Desktop</a> 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 <a href="https://ghost.org/downloads/" target="_blank" rel="noopener">Ghost Desktop</a>.'),
|
||||
{type: 'info', key: 'koenig.browserSupport'}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
this._blurAndScheduleAction(function () {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue