mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 02:19:52 +02:00
Deprecating using setNode to update nodes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
import Debug from 'debug'
|
||||
import warning from '../utils/warning'
|
||||
|
||||
/**
|
||||
* Debug.
|
||||
@@ -294,6 +295,12 @@ function setNode(state, operation) {
|
||||
const { path, properties } = operation
|
||||
let { document } = state
|
||||
let node = document.assertPath(path)
|
||||
|
||||
// Deprecate using setNode for updating children
|
||||
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.')
|
||||
}
|
||||
|
||||
node = node.merge(properties)
|
||||
document = document.updateDescendant(node)
|
||||
state = state.merge({ document })
|
||||
|
Reference in New Issue
Block a user