Skip to content

Commit

Permalink
Move logic to dispatchTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Feb 13, 2025
1 parent e2d7a1d commit 9f64171
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 0 additions & 10 deletions panel/src/components/Forms/Input/WriterInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,6 @@ export default {
return;
}
// if no steps are recorded, this is a selection change
// and we don't need to update the content
if (payload.transaction.steps.length === 0) {
return;
}
if (payload.transaction.meta.preventUpdate === true) {
return;
}
// compare documents to avoid minor HTML differences
// to cause unwanted updates
const jsonNew = JSON.stringify(this.editor.getJSON());
Expand Down
6 changes: 5 additions & 1 deletion panel/src/components/Forms/Writer/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ export default class Editor extends Emitter {

// Only emit an update if the doc has changed and
// an update has not been actively prevented
if (transaction.docChanged || !transaction.getMeta("preventUpdate")) {
if (
transaction.docChanged &&
!transaction.getMeta("preventUpdate") &&
transaction.steps.length > 0
) {
this.emit("update", payload);
}

Expand Down

0 comments on commit 9f64171

Please sign in to comment.