mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 05:01:17 +02:00
setNode cannot be used to update key and nodes
This commit is contained in:
@@ -296,9 +296,13 @@ function setNode(state, operation) {
|
||||
let { document } = state
|
||||
let node = document.assertPath(path)
|
||||
|
||||
// Deprecate using setNode for updating children
|
||||
// Deprecate using setNode for updating children, or keys
|
||||
if (properties.nodes && properties.nodes != node.nodes) {
|
||||
warning('Updating Node.nodes through setNode is deprecated. Use the appropriate insertion and removal functions, rather than, for example, setNodeByKey.')
|
||||
warning('Updating Node.nodes through setNode is not allowed. Use appropriate insertion and removal functions.')
|
||||
delete properties.nodes
|
||||
} else if (properties.key && properties.key != node.key) {
|
||||
warning('Updating Node.key through setNode is not allowed. You should not have to update keys yourself.')
|
||||
delete properties.key
|
||||
}
|
||||
|
||||
node = node.merge(properties)
|
||||
|
Reference in New Issue
Block a user