From f791f522678aafe2621ccbdcc9fb5957fb841b3d Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 14 May 2018 15:53:34 +0100 Subject: [PATCH] Koenig - Fixed text deselection when toggling section formatting via toolbar refs https://github.com/TryGhost/Ghost/issues/9623 - maintains easy reversibility by keeping text selected and toolbar shown in the same position to avoid jumping buttons when font size or other formatting changes --- lib/koenig-editor/addon/components/koenig-toolbar.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/koenig-editor/addon/components/koenig-toolbar.js b/lib/koenig-editor/addon/components/koenig-toolbar.js index a3ac2ef58..2ca8c8645 100644 --- a/lib/koenig-editor/addon/components/koenig-toolbar.js +++ b/lib/koenig-editor/addon/components/koenig-toolbar.js @@ -26,6 +26,7 @@ export default Component.extend({ classNames: ['absolute', 'z-999'], // public attrs + editor: null, editorRange: null, activeMarkupTagNames: null, activeSectionTagNames: null, @@ -120,7 +121,11 @@ export default Component.extend({ }, toggleSection(sectionName) { + let range = this.editorRange; this.toggleSection(sectionName); + this.editor.run((postEditor) => { + postEditor.setRange(range); + }); }, editLink() {