1
0
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:
Ziad Beyens
2023-02-22 12:54:35 +01:00
committed by GitHub
parent d0d1cb981b
commit 84f811a79c
6 changed files with 95 additions and 39 deletions

View 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.