Update:
I’ve tweaked several things elsewhere in the same timeframe, but I’m pretty sure my issue here just came down to the fact that I was using an arrow function in the nodeViews object.
Any idea what I’m doing wrong here?
Part of an event handler in a nodeView
class:
const height = 'some px value';
const tr = this.view.state.tr;
tr.setNodeMarkup(this.getPos(), null, { height });
this.view.dispatch(tr);
schema section:
resizable: {
attrs: { height: { default: 'auto' }, width: { default: 'auto' } },
content: 'block*',
draggable: true,
parseDOM: [
{
getAttrs: dom => ({ height: dom.style.height, width: dom.style.width }),
tag: 'resizable'
}
],
selectable: false,
toDOM: node => {
const { height, width } = node.attrs;
return ['resizable', { style: `height: ${height}; width: ${width};` }, 0];
}
}
My test case is doc with this node and a simple paragraph inside.
I still got this error when grabbing the pos
via this.view.state.doc.descendants
.