From e5a2047c4c25d308eb485d421c01f0866d4f8e65 Mon Sep 17 00:00:00 2001 From: carlobeltrame Date: Thu, 18 Apr 2024 14:55:09 +0200 Subject: [PATCH] Debug #320 --- .../js/components/feedback/FeedbackEditor.vue | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/resources/js/components/feedback/FeedbackEditor.vue b/resources/js/components/feedback/FeedbackEditor.vue index a14d3b8d..8bdf1765 100644 --- a/resources/js/components/feedback/FeedbackEditor.vue +++ b/resources/js/components/feedback/FeedbackEditor.vue @@ -79,24 +79,26 @@ export default { this.focused = true }, onCreate: ({ editor }) => { - let creating = true - editor.on('update', ({editor, transaction}) => { - this.currentValue = editor.getJSON() - console.log('FeedbackEditor input', this.currentValue) - this.$emit('input', this.currentValue) - // onUpdate is also called while creating the editor, so filter that call out - if (!this.isRemoteChange(transaction) && !creating) { - console.log('FeedbackEditor localinput', this.currentValue) - this.$emit('localinput', this.currentValue) - } - creating = false - }) - } + console.log('onCreate') + this.creating = false + }, + onUpdate: ({ editor, transaction }) => { + if (this.creating) return + console.log('onUpdate') + this.currentValue = editor.getJSON() + console.log('FeedbackEditor input (onUpdate)', this.currentValue) + this.$emit('input', this.currentValue) + if (!this.isRemoteChange(transaction)) { + console.log('FeedbackEditor localinput (onUpdate)', this.currentValue) + this.$emit('localinput', this.currentValue) + } + }, }) const emptyDocument = editor.getJSON() return { editor: editor, + creating: true, currentValue: this.value ?? emptyDocument, emptyDocument, focused: false,