Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit b2a9e4c

Browse files
committed
Koenig - Show alert for unsupported browsers
refs TryGhost/Ghost#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
1 parent 4a59500 commit b2a9e4c

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

app/routes/editor.js

+37
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,53 @@ import $ from 'jquery';
22
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
33
import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route';
44
import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd';
5+
import {htmlSafe} from '@ember/string';
56
import {run} from '@ember/runloop';
7+
import {inject as service} from '@ember/service';
68

79
let generalShortcuts = {};
810
generalShortcuts[`${ctrlOrCmd}+shift+p`] = 'publish';
911

1012
export default AuthenticatedRoute.extend(ShortcutsRoute, {
13+
feature: service(),
14+
notifications: service(),
15+
userAgent: service(),
16+
1117
classNames: ['editor'],
1218
shortcuts: generalShortcuts,
1319
titleToken: 'Editor',
1420

21+
setupController() {
22+
this._super(...arguments);
23+
24+
// display a warning if we detect an unsupported browser
25+
if (this.feature.koenigEditor) {
26+
// IE is definitely not supported and will not work at all in Ghost 2.0
27+
if (this.userAgent.browser.isIE) {
28+
this.notifications.showAlert(
29+
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.'),
30+
{type: 'info', key: 'koenig.browserSupport'}
31+
);
32+
}
33+
34+
// edge has known issues
35+
if (this.userAgent.browser.isEdge) {
36+
this.notifications.showAlert(
37+
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.'),
38+
{type: 'info', key: 'koenig.browserSupport'}
39+
);
40+
}
41+
42+
// mobile browsers are not currently supported
43+
if (this.userAgent.device.isMobile || this.userAgent.device.isTablet) {
44+
this.notifications.showAlert(
45+
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>.'),
46+
{type: 'info', key: 'koenig.browserSupport'}
47+
);
48+
}
49+
}
50+
},
51+
1552
actions: {
1653
save() {
1754
this._blurAndScheduleAction(function () {

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"ember-svg-jar": "1.2.0",
9494
"ember-test-selectors": "1.0.0",
9595
"ember-truth-helpers": "2.0.0",
96+
"ember-useragent": "0.6.1",
9697
"ember-wormhole": "0.5.4",
9798
"emberx-file-input": "1.2.1",
9899
"eslint": "4.19.1",

yarn.lock

+22
Original file line numberDiff line numberDiff line change
@@ -4153,6 +4153,17 @@ [email protected], ember-truth-helpers@^2.0.0:
41534153
dependencies:
41544154
ember-cli-babel "^6.8.2"
41554155

4156+
4157+
version "0.6.1"
4158+
resolved "https://registry.yarnpkg.com/ember-useragent/-/ember-useragent-0.6.1.tgz#0854b3c11acf0fdd98a165fba9bf5dc76eace804"
4159+
dependencies:
4160+
broccoli-debug "^0.6.3"
4161+
broccoli-funnel "^2.0.1"
4162+
broccoli-merge-trees "^3.0.0"
4163+
ember-cli-babel "^6.6.0"
4164+
fastboot-transform "^0.1.2"
4165+
ua-parser-js "^0.7.14"
4166+
41564167
ember-weakmap@^3.0.0:
41574168
version "3.2.0"
41584169
resolved "https://registry.yarnpkg.com/ember-weakmap/-/ember-weakmap-3.2.0.tgz#663871d7a8bb085c5b1cedcb3fb183857990343f"
@@ -4771,6 +4782,13 @@ fast-sourcemap-concat@^1.0.1:
47714782
source-map-url "^0.3.0"
47724783
sourcemap-validator "^1.0.5"
47734784

4785+
fastboot-transform@^0.1.2:
4786+
version "0.1.3"
4787+
resolved "https://registry.yarnpkg.com/fastboot-transform/-/fastboot-transform-0.1.3.tgz#7dea0b117594afd8772baa6c9b0919644e7f7dcd"
4788+
dependencies:
4789+
broccoli-stew "^1.5.0"
4790+
convert-source-map "^1.5.1"
4791+
47744792
faye-websocket@~0.10.0:
47754793
version "0.10.0"
47764794
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:
99019919
version "0.0.6"
99029920
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
99039921

9922+
ua-parser-js@^0.7.14:
9923+
version "0.7.18"
9924+
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed"
9925+
99049926
uc.micro@^1.0.1, uc.micro@^1.0.5:
99059927
version "1.0.5"
99069928
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376"

0 commit comments

Comments
 (0)