mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
4aa9d4554e
no issue We made very limited use of the `ua-parser-js` sub-dependency that `ember-useragent` pulls in so it didn't seem worth having the fairly large 17KB import or the associated sub-dependency version resolutions. - switched the two iOS and Safari detections to use associated Regexes on `navigator.userAgent` - dropped the "Microsoft Edge not supported" message in the editor - old Edge is still not supported but it was been replaced with a Chromium-based version that is supported a while back - we can re-introduce a warning if we get any significant reports (there is nothing showing in Sentry for this alert in the last 14 days)
67 lines
1.8 KiB
JavaScript
67 lines
1.8 KiB
JavaScript
import $ from 'jquery';
|
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import {run} from '@ember/runloop';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default AuthenticatedRoute.extend({
|
|
feature: service(),
|
|
notifications: service(),
|
|
ui: service(),
|
|
|
|
classNames: ['editor'],
|
|
|
|
activate() {
|
|
this._super(...arguments);
|
|
this.ui.set('isFullScreen', true);
|
|
},
|
|
|
|
deactivate() {
|
|
this._super(...arguments);
|
|
this.ui.set('isFullScreen', false);
|
|
},
|
|
|
|
actions: {
|
|
save() {
|
|
this._blurAndScheduleAction(function () {
|
|
this.controller.send('save');
|
|
});
|
|
},
|
|
|
|
authorizationFailed() {
|
|
this.controller.send('toggleReAuthenticateModal');
|
|
},
|
|
|
|
willTransition(transition) {
|
|
// exit early if an upgrade is required because our extended route
|
|
// class will abort the transition and show an error
|
|
if (this.get('upgradeStatus.isRequired')) {
|
|
return this._super(...arguments);
|
|
}
|
|
|
|
this.controller.willTransition(transition);
|
|
}
|
|
},
|
|
|
|
buildRouteInfoMetadata() {
|
|
return {
|
|
titleToken: () => {
|
|
return this.get('controller.post.title') || 'Editor';
|
|
},
|
|
bodyClasses: ['gh-body-fullscreen'],
|
|
mainClasses: ['gh-main-white']
|
|
};
|
|
},
|
|
|
|
_blurAndScheduleAction(func) {
|
|
let selectedElement = $(document.activeElement);
|
|
|
|
// TODO: we should trigger a blur for textareas as well as text inputs
|
|
if (selectedElement.is('input[type="text"]')) {
|
|
selectedElement.trigger('focusout');
|
|
}
|
|
|
|
// wait for actions triggered by the focusout to finish before saving
|
|
run.scheduleOnce('actions', this, func);
|
|
}
|
|
});
|