mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-29 18:09:49 +02:00
Fix addMark/removeMark caused unexpected onChange. (#4227)
* Fix addMark/removeMark caused unexpected onChange. * Create three-parrots-remember.md Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
This commit is contained in:
5
.changeset/three-parrots-remember.md
Normal file
5
.changeset/three-parrots-remember.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate': patch
|
||||
---
|
||||
|
||||
Fixed a bug that would allow multiple changes to be scheduled at the same time.
|
@@ -106,9 +106,11 @@ export const createEditor = (): Editor => {
|
||||
}
|
||||
|
||||
editor.marks = marks
|
||||
if (!FLUSHING.get(editor)) {
|
||||
editor.onChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
deleteBackward: (unit: 'character' | 'word' | 'line' | 'block') => {
|
||||
@@ -296,9 +298,11 @@ export const createEditor = (): Editor => {
|
||||
const marks = { ...(Editor.marks(editor) || {}) }
|
||||
delete marks[key]
|
||||
editor.marks = marks
|
||||
if (!FLUSHING.get(editor)) {
|
||||
editor.onChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user