Hello folks. I am trying to make a new Node in the writer field following this Guide. It should be a bulletList but with the class .checked, so it should behave like a normal “bulletList” Node.
I am not familiar with all that .js stuff, but I got something that works out and adds a
<ul class="checked"></ul>
, unless I add “bulletList”. The bulletList Node seems to overwrite everything I do and i end up with a normal ul-Tag without Classes in the writer.
Here is my Code inside my-plugin/index.js
window.panel.plugin('my/plugin', {
writerNodes: {
checkedList: {
get button() {
return {
icon: "check",
label: "Check-Liste",
when: ["listItem", "checkedList", "bulletList", "orderedList", "paragraph"]
};
},
commands({type, schema, utils}) {
return () => utils.toggleList(type, schema.nodes.listItem);
},
inputRules({type, utils}) {
return [utils.wrappingInputRule(/^\s*([-+*])\s$/, type)];
},
keys({type, schema, utils}) {
return {
"Shift-Ctrl-8": utils.toggleList(type, schema.nodes.listItem)
};
},
get name() {
return "checkedList";
},
get schema() {
return {
content: "listItem+",
group: "block",
attrs: {
class: 'test'
},
parseDOM: [{tag: "ul"}],
toDOM: () => ['ul', {class: 'checked'}, 0]
};
}
}
}
});
So can anyone tell me what I missed? Or does anyone have a better idea of adding a “checked list” button additional to bulletList and orderedList?
Thanks for your help! <3