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({
|
||||
|
||||
// public attrs
|
||||
tagName: '',
|
||||
classNames: ['gh-koenig-editor'],
|
||||
title: '',
|
||||
titlePlaceholder: '',
|
||||
body: null,
|
||||
|
@ -35,6 +35,9 @@ export default Component.extend({
|
|||
this._editor.run((postEditor) => {
|
||||
postEditor.setRange(range.tail.section.tailPosition());
|
||||
});
|
||||
|
||||
// ensure we're scrolled to the bottom
|
||||
this.element.scrollTop = this.element.scrollHeight;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
{{!-- scrollable container --}}
|
||||
<div class="gh-koenig-editor">
|
||||
{{!-- full height content pane --}}
|
||||
<div class="gh-koenig-editor-pane" onclick={{action "focusEditor"}}>
|
||||
{{gh-textarea title
|
||||
class="gh-editor-title"
|
||||
placeholder=titlePlaceholder
|
||||
tabindex="1"
|
||||
autoExpand=".gh-koenig-editor"
|
||||
update=(action "onTitleChange")
|
||||
focusOut=(action "onTitleFocusOut")
|
||||
keyDown=(action "onTitleKeydown")
|
||||
didCreateTextarea=(action "onTitleCreated")
|
||||
}}
|
||||
{{!-- full height content pane --}}
|
||||
<div class="gh-koenig-editor-pane" onclick={{action "focusEditor"}}>
|
||||
{{gh-textarea title
|
||||
class="gh-editor-title"
|
||||
placeholder=titlePlaceholder
|
||||
tabindex="1"
|
||||
autoExpand=".gh-koenig-editor"
|
||||
update=(action "onTitleChange")
|
||||
focusOut=(action "onTitleFocusOut")
|
||||
keyDown=(action "onTitleKeydown")
|
||||
didCreateTextarea=(action "onTitleCreated")
|
||||
}}
|
||||
|
||||
{{koenig-editor
|
||||
mobiledoc=body
|
||||
placeholder=bodyPlaceholder
|
||||
autofocus=bodyAutofocus
|
||||
spellcheck=true
|
||||
onChange=(action "onBodyChange")
|
||||
didCreateEditor=(action "onEditorCreated")
|
||||
}}
|
||||
</div>
|
||||
{{koenig-editor
|
||||
mobiledoc=body
|
||||
placeholder=bodyPlaceholder
|
||||
autofocus=bodyAutofocus
|
||||
spellcheck=true
|
||||
onChange=(action "onBodyChange")
|
||||
didCreateEditor=(action "onEditorCreated")
|
||||
}}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue