mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Koenig - Fixed jump-to-top bug when focusing editor
refs https://github.com/TryGhost/Ghost/issues/9311 - the editor was being focused and the cursor placed properly but the act of focusing also reset the scroll position - pulled the `.gh-koenig-editor` class into the component rather than leaving it in the template so that the component has access to `this.element` - ensure the `.gh-koenig-editor` container is scrolled all the way to the bottom after focusing the editor
This commit is contained in:
parent
d25fb1597e
commit
cd0e7ebc64
2 changed files with 24 additions and 24 deletions
|
@ -3,7 +3,7 @@ import Component from '@ember/component';
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
|
||||||
// public attrs
|
// public attrs
|
||||||
tagName: '',
|
classNames: ['gh-koenig-editor'],
|
||||||
title: '',
|
title: '',
|
||||||
titlePlaceholder: '',
|
titlePlaceholder: '',
|
||||||
body: null,
|
body: null,
|
||||||
|
@ -35,6 +35,9 @@ export default Component.extend({
|
||||||
this._editor.run((postEditor) => {
|
this._editor.run((postEditor) => {
|
||||||
postEditor.setRange(range.tail.section.tailPosition());
|
postEditor.setRange(range.tail.section.tailPosition());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ensure we're scrolled to the bottom
|
||||||
|
this.element.scrollTop = this.element.scrollHeight;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
{{!-- scrollable container --}}
|
|
||||||
<div class="gh-koenig-editor">
|
|
||||||
{{!-- full height content pane --}}
|
{{!-- full height content pane --}}
|
||||||
<div class="gh-koenig-editor-pane" onclick={{action "focusEditor"}}>
|
<div class="gh-koenig-editor-pane" onclick={{action "focusEditor"}}>
|
||||||
{{gh-textarea title
|
{{gh-textarea title
|
||||||
|
@ -22,4 +20,3 @@
|
||||||
didCreateEditor=(action "onEditorCreated")
|
didCreateEditor=(action "onEditorCreated")
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue