diff --git a/.changeset/three-parrots-remember.md b/.changeset/three-parrots-remember.md new file mode 100644 index 000000000..17c0ee497 --- /dev/null +++ b/.changeset/three-parrots-remember.md @@ -0,0 +1,5 @@ +--- +'slate': patch +--- + +Fixed a bug that would allow multiple changes to be scheduled at the same time. diff --git a/packages/slate/src/create-editor.ts b/packages/slate/src/create-editor.ts index f19d93846..a7b8399fe 100644 --- a/packages/slate/src/create-editor.ts +++ b/packages/slate/src/create-editor.ts @@ -106,7 +106,9 @@ export const createEditor = (): Editor => { } editor.marks = marks - editor.onChange() + if (!FLUSHING.get(editor)) { + editor.onChange() + } } } }, @@ -296,7 +298,9 @@ export const createEditor = (): Editor => { const marks = { ...(Editor.marks(editor) || {}) } delete marks[key] editor.marks = marks - editor.onChange() + if (!FLUSHING.get(editor)) { + editor.onChange() + } } } },