1
0
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:
Soreine
2016-10-26 16:17:05 +02:00
parent 97aa3ecd93
commit 62b8ed205e

View File

@@ -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)