Skip to content

Commit

Permalink
Debug #320
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobeltrame committed Apr 18, 2024
1 parent 0551a73 commit f85491a
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions resources/js/components/feedback/FeedbackEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,17 @@ export default {
onFocus: () => {
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
})
}
onUpdate: ({ editor, transaction }) => {
if (JSON.stringify(this.currentValue) === JSON.stringify(editor.getJSON())) 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()
Expand Down

0 comments on commit f85491a

Please sign in to comment.