0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Updated focus to toggle card heading in edit mode

refs https://github.com/TryGhost/Team/issues/1209
This commit is contained in:
Rishabh 2021-11-18 11:46:43 +05:30
parent 0c4f9c8c6a
commit e4b3beee75

View file

@ -104,7 +104,7 @@ export default class KoenigCardAccordionComponent extends Component {
this._textReplacementEditor = textReplacementEditor; this._textReplacementEditor = textReplacementEditor;
run.scheduleOnce('afterRender', this, this._placeCursorAtEnd); run.scheduleOnce('afterRender', this, this._afterRender);
} }
_enter(modifier) { _enter(modifier) {
@ -113,6 +113,11 @@ export default class KoenigCardAccordionComponent extends Component {
} }
} }
_afterRender() {
this._placeCursorAtEnd();
this._focusInput();
}
_placeCursorAtEnd() { _placeCursorAtEnd() {
if (!this._textReplacementEditor) { if (!this._textReplacementEditor) {
return; return;
@ -131,4 +136,12 @@ export default class KoenigCardAccordionComponent extends Component {
// update the mobiledoc and stay in edit mode // update the mobiledoc and stay in edit mode
this.args.saveCard?.(payload, false); this.args.saveCard?.(payload, false);
} }
_focusInput() {
let headingInput = this.element.querySelector('.kg-accordion-card-heading .koenig-basic-html-input__editor');
if (headingInput) {
headingInput.focus();
}
}
} }