Skip to content

Commit 724e7fa

Browse files
Merge pull request #5353 from nextcloud-libraries/fix/5352/tribute-on-close-focus
fix(NcRichContenteditable): capture and stop `Esc` keydown event when closing tribute
2 parents 37db420 + 4762758 commit 724e7fa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/NcRichContenteditable/NcRichContenteditable.vue

+9
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ export default {
242242
@compositionstart="isComposing = true"
243243
@compositionend="isComposing = false"
244244
@keydown.delete="onDelete"
245+
@keydown.esc.capture="onKeyEsc"
245246
@keydown.enter.exact="onEnter"
246247
@keydown.ctrl.enter.exact.stop.prevent="onCtrlEnter"
247248
@paste="onPaste"
@@ -875,6 +876,14 @@ export default {
875876
event.stopImmediatePropagation()
876877
},
877878

879+
onKeyEsc(event) {
880+
// prevent event from bubbling when tribute is open
881+
if (this.tribute && this.isAutocompleteOpen) {
882+
event.stopImmediatePropagation()
883+
this.tribute.hideMenu()
884+
}
885+
},
886+
878887
/**
879888
* Get HTML element with Tribute.js container
880889
* @return {HTMLElement}

0 commit comments

Comments
 (0)