I have a basic checklist implementation, but when I copy and paste elements the attributes aren’t coming along, and I’m not completely sure why. Here’s my rough implementation:
check_item: {
attrs: {
checked: { default: false }
},
defining: true,
draggable: true,
parseDOM: [{ tag: "div.checkItem" }],
content: "paragraph block*",
toDOM: node => {
const classes = ["checkItem"];
if (node.attrs.checked) {
classes.push("checked");
}
return ["div", { class: classes.join(" ") }, 0];
}
}
My understanding was that parseDOM
would be used to handle the attributes, but while testing getAttrs
was never called when copying and pasting. Has anyone seen issues like this?