1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

update setBlockAtRange() transform to use primitives

This commit is contained in:
Ian Storm Taylor
2016-08-16 23:04:32 -07:00
parent 5687573800
commit 650f467126

View File

@@ -613,19 +613,14 @@ export function removeMarkAtRange(transform, range, mark) {
*/ */
export function setBlockAtRange(transform, range, properties = {}) { export function setBlockAtRange(transform, range, properties = {}) {
let { state } = transform const { state } = transform
properties = Normalize.nodeProperties(properties) const { document } = state
let { document } = state
const blocks = document.getBlocksAtRange(range) const blocks = document.getBlocksAtRange(range)
blocks.forEach((block) => { blocks.forEach((block) => {
block = block.merge(properties) transform.setNodeByKey(block.key, properties)
document = document.updateDescendant(block)
}) })
document = document.normalize()
state = state.merge({ document })
transform.state = state
return transform return transform
} }