🐛 Koenig - Fixed required double-click on (+) when cursor is not in same paragraph

refs https://github.com/TryGhost/Ghost/issues/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
This commit is contained in:
Kevin Ansfield 2018-07-18 15:04:02 +01:00
parent e659dcdec7
commit 235d71d6a0
2 changed files with 4 additions and 2 deletions

View File

@ -66,11 +66,12 @@ export default Component.extend({
}
// hide the menu if the editor range has changed
if (this.showMenu && editorRange && !editorRange.isBlank && !editorRange.isEqual(this._lastEditorRange)) {
if (!this._ignoreRangeChange && this.showMenu && editorRange && !editorRange.isBlank && !editorRange.isEqual(this._lastEditorRange)) {
this._hideMenu();
}
this._lastEditorRange = editorRange;
this._ignoreRangeChange = false;
},
willDestroyElement() {
@ -273,6 +274,7 @@ export default Component.extend({
},
_moveCaretToCachedEditorRange() {
this._ignoreRangeChange = true;
this.set('editorRange', this._editorRange);
this.editor.selectRange(this._editorRange);
}

View File

@ -1,5 +1,5 @@
{{#if showButton}}
<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>
<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>
{{/if}}
{{#if showMenu}}