mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
This reverts commit 3c2f3da689
.
This commit is contained in:
parent
203afcb531
commit
844bb3277d
@ -3,7 +3,7 @@ import Mixin from 'ember-metal/mixin';
|
|||||||
import PostModel from 'ghost-admin/models/post';
|
import PostModel from 'ghost-admin/models/post';
|
||||||
import RSVP from 'rsvp';
|
import RSVP from 'rsvp';
|
||||||
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
||||||
import computed, {mapBy, reads} from 'ember-computed';
|
import computed, {alias, mapBy, reads} from 'ember-computed';
|
||||||
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||||
import injectController from 'ember-controller/inject';
|
import injectController from 'ember-controller/inject';
|
||||||
import injectService from 'ember-service/inject';
|
import injectService from 'ember-service/inject';
|
||||||
@ -51,6 +51,9 @@ export default Mixin.create({
|
|||||||
editor: null,
|
editor: null,
|
||||||
editorMenuIsOpen: false,
|
editorMenuIsOpen: false,
|
||||||
|
|
||||||
|
shouldFocusTitle: alias('model.isNew'),
|
||||||
|
shouldFocusEditor: false,
|
||||||
|
|
||||||
navIsClosed: reads('application.autoNav'),
|
navIsClosed: reads('application.autoNav'),
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
@ -5,6 +5,12 @@ import base from 'ghost-admin/mixins/editor-base-route';
|
|||||||
export default AuthenticatedRoute.extend(base, {
|
export default AuthenticatedRoute.extend(base, {
|
||||||
titleToken: 'Editor',
|
titleToken: 'Editor',
|
||||||
|
|
||||||
|
beforeModel(transition) {
|
||||||
|
this.set('_transitionedFromNew', transition.data.fromNew);
|
||||||
|
|
||||||
|
this._super(...arguments);
|
||||||
|
},
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
let query = {
|
let query = {
|
||||||
@ -36,6 +42,11 @@ export default AuthenticatedRoute.extend(base, {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setupController(controller) {
|
||||||
|
this._super(...arguments);
|
||||||
|
controller.set('shouldFocusEditor', this.get('_transitionedFromNew'));
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
authorizationFailed() {
|
authorizationFailed() {
|
||||||
this.get('controller').send('toggleReAuthenticateModal');
|
this.get('controller').send('toggleReAuthenticateModal');
|
||||||
|
@ -17,5 +17,15 @@ export default AuthenticatedRoute.extend(base, {
|
|||||||
controller,
|
controller,
|
||||||
model
|
model
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
willTransition(transition) {
|
||||||
|
// decorate the transition object so the editor.edit route
|
||||||
|
// knows this was the previous active route
|
||||||
|
transition.data.fromNew = true;
|
||||||
|
|
||||||
|
this._super(...arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
--}}
|
--}}
|
||||||
{{#gh-markdown-editor
|
{{#gh-markdown-editor
|
||||||
tabindex="2"
|
tabindex="2"
|
||||||
placeholder="Now begin writing your story..."
|
placeholder="Click here to start..."
|
||||||
autofocus=true
|
autofocus=shouldFocusEditor
|
||||||
uploadedImageUrls=editor.uploadedImageUrls
|
uploadedImageUrls=editor.uploadedImageUrls
|
||||||
mobiledoc=(readonly model.scratch)
|
mobiledoc=(readonly model.scratch)
|
||||||
isFullScreen=editor.isFullScreen
|
isFullScreen=editor.isFullScreen
|
||||||
@ -54,6 +54,7 @@
|
|||||||
class="gh-editor-title"
|
class="gh-editor-title"
|
||||||
placeholder="Your Post Title"
|
placeholder="Your Post Title"
|
||||||
tabindex="1"
|
tabindex="1"
|
||||||
|
shouldFocus=shouldFocusTitle
|
||||||
autoExpand=".gh-markdown-editor-pane"
|
autoExpand=".gh-markdown-editor-pane"
|
||||||
focusOut=(action "saveTitle")
|
focusOut=(action "saveTitle")
|
||||||
update=(action (perform updateTitle))
|
update=(action (perform updateTitle))
|
||||||
|
Loading…
Reference in New Issue
Block a user