Skip to content

Commit 72e4f02

Browse files
authored
Passing force property from normalize to normalizeNode method (#6006)
1 parent e2a940a commit 72e4f02

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

.changeset/olive-planes-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'slate': minor
3+
---
4+
5+
Added `force` property to `normalizeNode` passed from `normalize` method

packages/slate/src/editor/normalize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const normalize: EditorInterface['normalize'] = (
5757
by definition adding children to an empty node can't cause other paths to change.
5858
*/
5959
if (Node.isElement(node) && node.children.length === 0) {
60-
editor.normalizeNode(entry, { operation })
60+
editor.normalizeNode(entry, { operation, force })
6161
}
6262
}
6363
}
@@ -83,7 +83,7 @@ export const normalize: EditorInterface['normalize'] = (
8383
// If the node doesn't exist in the tree, it does not need to be normalized.
8484
if (Node.has(editor, dirtyPath)) {
8585
const entry = Editor.node(editor, dirtyPath)
86-
editor.normalizeNode(entry, { operation })
86+
editor.normalizeNode(entry, { operation, force })
8787
}
8888
iteration++
8989
dirtyPaths = getDirtyPaths(editor)

packages/slate/src/interfaces/editor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export interface BaseEditor {
5959
options?: {
6060
operation?: Operation
6161
fallbackElement?: () => Element
62+
force?: boolean
6263
}
6364
) => void
6465
onChange: (options?: { operation?: Operation }) => void

0 commit comments

Comments
 (0)