mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
5a47f2ae4b
refs TryGhost/Ghost#8723 - #795 contained a regression where the body focus was lost during the new->edit transition because at that point `model.isNew` is false - returns `shouldFocusEditor` code that was removed in #768 (it was assumed the body should _always_ have focus in that PR) - instant-save if body is edited and the post is new - fixes issue where you could keep typing without any save when body had autofocus - don't show preview link for new posts - fixes issue where it links directly to the admin endpoint so it would force a refresh
32 lines
812 B
JavaScript
32 lines
812 B
JavaScript
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import base from 'ghost-admin/mixins/editor-base-route';
|
|
|
|
export default AuthenticatedRoute.extend(base, {
|
|
titleToken: 'Editor',
|
|
|
|
model() {
|
|
return this.get('session.user').then((user) => {
|
|
return this.store.createRecord('post', {
|
|
author: user
|
|
});
|
|
});
|
|
},
|
|
|
|
renderTemplate(controller, model) {
|
|
this.render('editor/edit', {
|
|
controller,
|
|
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);
|
|
}
|
|
}
|
|
});
|