mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-13 02:34:05 +02:00
More control on editor.normalizeNode
(#5295)
* feat * fix * Create two-books-bow.md * docs * feat * fix
This commit is contained in:
21
.changeset/two-books-bow.md
Normal file
21
.changeset/two-books-bow.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
'slate': patch
|
||||
---
|
||||
|
||||
New `editor` method that can be overridden to control when the normalization should stop. Default behavior (unchanged) is to throw an error when it iterates over 42 times the dirty paths length.
|
||||
|
||||
```ts
|
||||
shouldNormalize: ({
|
||||
iteration,
|
||||
dirtyPaths,
|
||||
operation,
|
||||
}: {
|
||||
iteration: number
|
||||
dirtyPaths: Path[]
|
||||
operation?: Operation
|
||||
}) => boolean
|
||||
```
|
||||
|
||||
- `editor.onChange` signature change: `(options?: { operation?: Operation }) => void` where `operation` is triggering the function.
|
||||
- `editor.normalizeNode` signature change: `(entry: NodeEntry, options?: { operation?: Operation }) => void` where `operation` is triggering the function.
|
||||
- `EditorNormalizeOptions` new option `operation?: Operation` where `operation` is triggering the function.
|
Reference in New Issue
Block a user