mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-01 05:16:10 +01:00
fix sibling validation error names
This commit is contained in:
parent
2092981e0c
commit
d461fdae72
@ -12,6 +12,8 @@ export const FIRST_CHILD_OBJECT_INVALID = 'first_child_object_invalid'
|
||||
export const FIRST_CHILD_TYPE_INVALID = 'first_child_type_invalid'
|
||||
export const LAST_CHILD_OBJECT_INVALID = 'last_child_object_invalid'
|
||||
export const LAST_CHILD_TYPE_INVALID = 'last_child_type_invalid'
|
||||
export const NEXT_SIBLING_OBJECT_INVALID = 'next_sibling_object_invalid'
|
||||
export const NEXT_SIBLING_TYPE_INVALID = 'next_sibling_type_invalid'
|
||||
export const NODE_DATA_INVALID = 'node_data_invalid'
|
||||
export const NODE_IS_VOID_INVALID = 'node_is_void_invalid'
|
||||
export const NODE_MARK_INVALID = 'node_mark_invalid'
|
||||
@ -20,3 +22,5 @@ export const NODE_TEXT_INVALID = 'node_text_invalid'
|
||||
export const NODE_TYPE_INVALID = 'node_type_invalid'
|
||||
export const PARENT_OBJECT_INVALID = 'parent_object_invalid'
|
||||
export const PARENT_TYPE_INVALID = 'parent_type_invalid'
|
||||
export const PREVIOUS_SIBLING_OBJECT_INVALID = 'previous_sibling_object_invalid'
|
||||
export const PREVIOUS_SIBLING_TYPE_INVALID = 'previous_sibling_type_invalid'
|
||||
|
@ -138,9 +138,9 @@ const CORE_RULES = [
|
||||
i = 0
|
||||
} else if (code === 'last_child_object_invalid') {
|
||||
i = node.nodes.size
|
||||
} else if (code === 'previous_child_object_invalid') {
|
||||
} else if (code === 'previous_sibling_object_invalid') {
|
||||
i = index
|
||||
} else if (code === 'next_child_object_invalid') {
|
||||
} else if (code === 'next_sibling_object_invalid') {
|
||||
i = index + 1
|
||||
} else {
|
||||
return
|
||||
@ -156,7 +156,7 @@ const CORE_RULES = [
|
||||
next: [{ object: 'block' }, { object: 'inline' }],
|
||||
normalize: (change, error) => {
|
||||
const { code, next } = error
|
||||
if (code !== 'next_child_object_invalid') return
|
||||
if (code !== 'next_sibling_object_invalid') return
|
||||
change.mergeNodeByKey(next.key, { normalize: false })
|
||||
},
|
||||
},
|
||||
@ -714,7 +714,7 @@ function validatePrevious(node, child, previous, index, rules) {
|
||||
error.child = child
|
||||
error.index = index
|
||||
error.previous = previous
|
||||
error.code = error.code.replace('node_', 'previous_child_')
|
||||
error.code = error.code.replace('node_', 'previous_sibling_')
|
||||
return error
|
||||
}
|
||||
}
|
||||
@ -734,7 +734,7 @@ function validateNext(node, child, next, index, rules) {
|
||||
error.child = child
|
||||
error.index = index
|
||||
error.next = next
|
||||
error.code = error.code.replace('node_', 'next_child_')
|
||||
error.code = error.code.replace('node_', 'next_sibling_')
|
||||
return error
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user