I am trying to implement Table Editing in the editor using the prosemirror-tables
package. The tableNodes
method generates a schema for the node types required for the table, however I want to change how the table node is rendered. For example: I want the table
element to have a class of table
and need to append some attribute how can achieve it while removing the columnResizing they table custom styles applying but need to resize the table feature also need ,I need an help any suugesstion
In plugin using this part only columnResizing({cellMinWidth:100}), tableEditing(),
import { tableNodes } from "prosemirror-tables";
...tableNodes({
tableGroup: "inline",
cellContent: "paragraph",
cellAttributes: {
background: {
default: null,
getFromDOM(dom) { return dom?.style?.backgroundColor || null; },
setDOMAttr(value, attrs) {
if (value) attrs.style = (attrs.style || "") + `background-color: ${value};`;
}
}
},
}),
table: {
content: 'table_row*',
tableRole: 'table',
isolating: true,
group: "block",
parseDOM: [{ tag: 'table' }],
toDOM() {
return ['table',{style:"background-color:yellow;"}, 0];
},
},