Skip to content

Commit

Permalink
Merge pull request #3875 from nextcloud/fix/rich-contenteditable-fix-…
Browse files Browse the repository at this point in the history
…doubled-past-event

Remove doubling proxied event handlers in `NcRichContenteditable`
  • Loading branch information
ShGKme committed Jun 30, 2023
2 parents 3d77f33 + 9bdba1b commit 687e1f8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/components/NcRichContenteditable/NcRichContenteditable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ export default {
aria-multiline="true"
class="rich-contenteditable__input"
role="textbox"
v-on="listeners"
@input="onInput"
v-on="$listeners"
@keydown.delete="onDelete"
@keydown.enter.exact="onEnter"
@keydown.ctrl.enter.exact.stop.prevent="onCtrlEnter"
Expand Down Expand Up @@ -423,6 +423,23 @@ export default {
canEdit() {
return this.contenteditable && !this.disabled
},
/**
* Proxied native event handlers without custom event handlers
*
* @return {Record<string, Function>}
*/
listeners() {
/**
* All component's event handlers are set as native event handlers with by v-on directive.
* The component also raised custom events manually by $emit for corresponding events.
* As a result, it triggers handlers twice.
* The v-on="listeners" directive should only set proxied native events handler without custom events
*/
const listeners = { ...this.$listeners }
delete listeners.paste
return listeners
},
},
watch: {
Expand Down

0 comments on commit 687e1f8

Please sign in to comment.