mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
🐛 Fixed editor autofocus when starting a new post
no issue
- we were setting the `shouldFocusEditor` value correctly but then immediately resetting it again 🙈
- updated the logic to change the value when going from new->edit as well as setting it correctly _after_ all of the controller values are reset in the `setPost` method
This commit is contained in:
parent
630708f377
commit
56487dd9d4
1 changed files with 5 additions and 4 deletions
|
@ -498,12 +498,10 @@ export default Controller.extend({
|
||||||
this.set('useKoenig', false);
|
this.set('useKoenig', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// autofocus the editor if we have a new post, this also acts as a
|
|
||||||
// change signal to the persistent editor on new->edit
|
|
||||||
this.set('shouldFocusEditor', post.get('isNew'));
|
|
||||||
|
|
||||||
// don't do anything else if we're setting the same post
|
// don't do anything else if we're setting the same post
|
||||||
if (post === this.get('post')) {
|
if (post === this.get('post')) {
|
||||||
|
// set autofocus as change signal to the persistent editor on new->edit
|
||||||
|
this.set('shouldFocusEditor', post.get('isNew'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,6 +510,9 @@ export default Controller.extend({
|
||||||
|
|
||||||
this.set('post', post);
|
this.set('post', post);
|
||||||
|
|
||||||
|
// autofocus the editor if we have a new post
|
||||||
|
this.set('shouldFocusEditor', post.get('isNew'));
|
||||||
|
|
||||||
// need to set scratch values because they won't be present on first
|
// need to set scratch values because they won't be present on first
|
||||||
// edit of the post
|
// edit of the post
|
||||||
// TODO: can these be `boundOneWay` on the model as per the other attrs?
|
// TODO: can these be `boundOneWay` on the model as per the other attrs?
|
||||||
|
|
Loading…
Add table
Reference in a new issue