I’m using the nodeview to render a mark. But when I remove the mark, the nodeview won’t be destroy.
You mean the destroy
method isn’t called? That’s true — mark views don’t support any of the node view methods. I’ve pushed a patch to make this clearer in the docs.
Thanks for your reply. Yeah, that’s what I mean. I’m trying to render a tooltip for link mark with React. But now should I define link as a node?
link: {
group: "inline",
content: "text*",
inline: true,
attrs: {
href: {},
},
parseDOM: [
{
tag: "a[href]",
getAttrs(dom) {
return {
href: dom.getAttribute("href"),
};
},
},
],
toDOM(node) {
let { href } = node.attrs;
return ["a", { href }, 0];
},
}
Modeling links as nodes is probably not a good idea. And including extra stuff in a mark’s DOM representation is likely to cause problems anyway. You could try placing the tooltips with an editor-wide plugin instead of leaving it to the mark itself.
Well, Thanks for your advice.