I’m trying to use setNodeType
to set an attribute on a node, but it isn’t updating the node in the dom or doc.
updateMediaHeight (id, height) {
// Get PM Pos of node to change
let index = 0
let pos
for (let node of this.pm.doc.content) {
if (node.attrs.id === id) {
pos = new Pos([index], 0)
break
}
index++
}
// Set height attr on block
this.pm.tr.setNodeType(pos, GridSchema.nodeType('media'), {height}).apply()
}
Is something off with how I’m getting the Pos
or calling setNodeType
?
Would it be possible to have a more-direct method, like Transform.setNodeAttributes(node, attrs)?