Hi
In our work, we have started to implement the prosemirror editor. In it, we added support for tables, and have made use of cell attributes, example from schema
cellAttributes: {
background: {
default: null,
getFromDOM(dom) {
return (dom.dataset && dom.dataset.cellBackground) || null;
},
setDOMAttr(value, attrs) {
if (value){
attrs["data-cell-background"] = value
}
}
}
}
We have also implemented our own menubar. From the menu bar, we do the following to update background colour of table cells:
const cmd = setCellAttr("background", colour)
cmd(this.state, this.dispatch)
This works great. However, I’m having some problems figuring out how to
- On click on a button
- Iterate all table cells
- clear background attribute on iterated table cell
i.e. walk through all table cells, and call setCellAttr("background", null)
This is something we need when we want to “remove all styling” from the editor.
Thanks in advance