mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-19 14:27:07 +01:00
add child
to child_max_invalid
schema errors
This commit is contained in:
parent
f13571cb65
commit
b01992474c
@ -160,6 +160,7 @@ function defaultNormalize(editor, error) {
|
||||
const { code, node, child, next, previous, key, mark, index } = error
|
||||
|
||||
switch (code) {
|
||||
case 'child_max_invalid':
|
||||
case 'child_object_invalid':
|
||||
case 'child_type_invalid':
|
||||
case 'child_unknown':
|
||||
@ -201,10 +202,6 @@ function defaultNormalize(editor, error) {
|
||||
: editor.removeNodeByKey(node.key)
|
||||
}
|
||||
|
||||
case 'child_max_invalid': {
|
||||
return editor.removeNodeByKey(node.nodes.get(index).key)
|
||||
}
|
||||
|
||||
case 'node_data_invalid': {
|
||||
return node.data.get(key) === undefined && node.object !== 'document'
|
||||
? editor.removeNodeByKey(node.key)
|
||||
@ -431,6 +428,7 @@ function validateNodes(node, rule, rules = []) {
|
||||
rule,
|
||||
node,
|
||||
index,
|
||||
child: children.get(index),
|
||||
count,
|
||||
limit: max,
|
||||
})
|
||||
@ -508,6 +506,7 @@ function validateNodes(node, rule, rules = []) {
|
||||
node,
|
||||
index: index - 1,
|
||||
count,
|
||||
child: children.get(index - 1),
|
||||
limit: max,
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user