I’m trying to transform a slice that’s being pasted by modifying the node type, but that seems to be ignored.
Does the following make sense or am I using this incorrectly?
new Plugin({
props: {
transformPasted(slice) {
const result = new Slice(
slice.content,
slice.openStart,
slice.openEnd
)
// Is this how I should be transforming the slice to change its node type?
result.content.firstChild.type = schema.nodes.heading;
return result;
}
}
}),
Based on this description “Fired when something is pasted or dragged into the editor. The given slice represents the pasted content, and your handler can return a modified version to manipulate it before it is inserted into the document.”, it doesn’t seem like I need to mutate the state via a Transform, right?