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,