mirror of
https://github.com/TryGhost/Ghost-Admin.git
synced 2023-12-14 02:33:04 +01: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
0b8aff02fb
commit
3bbd488ff2
1 changed files with 5 additions and 4 deletions
|
@ -498,12 +498,10 @@ export default Controller.extend({
|
|||
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
|
||||
if (post === this.get('post')) {
|
||||
// set autofocus as change signal to the persistent editor on new->edit
|
||||
this.set('shouldFocusEditor', post.get('isNew'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -512,6 +510,9 @@ export default Controller.extend({
|
|||
|
||||
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
|
||||
// edit of the post
|
||||
// TODO: can these be `boundOneWay` on the model as per the other attrs?
|
||||
|
|
Loading…
Reference in a new issue