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