Skip to content

Commit

Permalink
Fix addMark/removeMark caused unexpected onChange. (#4227)
Browse files Browse the repository at this point in the history
* Fix addMark/removeMark caused unexpected onChange.

* Create three-parrots-remember.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
  • Loading branch information
ulion and ianstormtaylor authored May 6, 2021
1 parent 623960a commit e6413d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-parrots-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate': patch
---

Fixed a bug that would allow multiple changes to be scheduled at the same time.
8 changes: 6 additions & 2 deletions packages/slate/src/create-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export const createEditor = (): Editor => {
}

editor.marks = marks
editor.onChange()
if (!FLUSHING.get(editor)) {
editor.onChange()
}
}
}
},
Expand Down Expand Up @@ -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()
}
}
}
},
Expand Down

0 comments on commit e6413d4

Please sign in to comment.