Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable7] Remove doubling proxied event handlers in NcRichContenteditable #4295

Merged
merged 1 commit into from Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/components/NcRichContenteditable/NcRichContenteditable.vue
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