Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 61b210c

Browse files
committed
🐛 Koenig - Fixed required double-click on (+) when cursor is not in same paragraph
refs TryGhost/Ghost#9724 - ignore the range change which would otherwise close the menu when clicking a (+) next to a different paragraph then the one the cursor is currently on
1 parent 937520f commit 61b210c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/koenig-editor/addon/components/koenig-plus-menu.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ export default Component.extend({
6666
}
6767

6868
// hide the menu if the editor range has changed
69-
if (this.showMenu && editorRange && !editorRange.isBlank && !editorRange.isEqual(this._lastEditorRange)) {
69+
if (!this._ignoreRangeChange && this.showMenu && editorRange && !editorRange.isBlank && !editorRange.isEqual(this._lastEditorRange)) {
7070
this._hideMenu();
7171
}
7272

7373
this._lastEditorRange = editorRange;
74+
this._ignoreRangeChange = false;
7475
},
7576

7677
willDestroyElement() {
@@ -273,6 +274,7 @@ export default Component.extend({
273274
},
274275

275276
_moveCaretToCachedEditorRange() {
277+
this._ignoreRangeChange = true;
276278
this.set('editorRange', this._editorRange);
277279
this.editor.selectRange(this._editorRange);
278280
}

lib/koenig-editor/addon/templates/components/koenig-plus-menu.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#if showButton}}
2-
<button class="koenig-plus-menu-button flex justify-center items-center relative w9 h9 ba b--midlightgrey-l2 bg-white br-100 anim-normal" {{action "openMenu"}}>{{svg-jar "plus" class="w4 h4 stroke-middarkgrey i-strokew--2"}}</button>
2+
<button class="koenig-plus-menu-button flex justify-center items-center relative w9 h9 ba b--midlightgrey-l2 bg-white br-100 anim-normal" onclick={{action "openMenu"}}>{{svg-jar "plus" class="w4 h4 stroke-middarkgrey i-strokew--2"}}</button>
33
{{/if}}
44

55
{{#if showMenu}}

0 commit comments

Comments
 (0)