Skip to content

Commit

Permalink
Merge pull request #340 from gloggi/fix-autosave-bug
Browse files Browse the repository at this point in the history
Fix AutoSave on initial change in feedback
  • Loading branch information
carlobeltrame authored Apr 18, 2024
2 parents 9781206 + eb5940b commit 09cfdce
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion resources/js/components/feedback/FeedbackEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,21 @@ export default {
},
onCreate: ({ editor }) => {
let creating = true
// Ensure editor is fully loaded before setting creating to false
editor.on('transaction', () => {
if (creating) {
this.$nextTick(() => {
creating = false;
});
}
});
editor.on('update', ({editor, transaction}) => {
this.currentValue = editor.getJSON()
this.$emit('input', this.currentValue)
// onUpdate is also called while creating the editor, so filter that call out
if (!this.isRemoteChange(transaction) && !creating) {
this.$emit('localinput', this.currentValue)
}
creating = false
})
}
})
Expand Down

0 comments on commit 09cfdce

Please sign in to comment.