I can now copy a simple table from Excel and paste into the editor with the help of table plugin but is there a way to copy and paste the table styles too, like cell background color, font color?
Sure, but you need to add your own parsing to the schema. The plugin will only help you with the basics, if you want to customize it you’ll need to do your own thing. Take a look at https://github.com/ProseMirror/prosemirror-tables/blob/master/src/schema.js#L73, for the schema. Specifically, look at how getCellAttrs
is used to parse the rowspan
and colspan
attributes.
Font color is unrelated to your table cell, you need to parse classes or styles from a <span>
, <div>
, <font>
, whatever your source is generating.
Thanks for the response. Parsing schema is fine but my challenge is more of how to read styles from the clipboard?
What I described does exactly that. Copying from Excel copies HTML, which is parsed by parseDOM
when you paste.
I also meet the problem。Did you solve it?
Thank you