quill-delta-parser icon indicating copy to clipboard operation
quill-delta-parser copied to clipboard

Parse Quill 2 tables

Open CasperNH opened this issue 1 year ago • 4 comments

Do you plan to add the ability to parse tables from Quill version 2?

Basic example of table from Quill version 2: [{"insert":"1111"},{"attributes":{"table":"row-nffr"},"insert":"\n"},{"insert":"2222"},{"attributes":{"table":"row-nffr"},"insert":"\n"},{"insert":"3333"},{"attributes":{"table":"row-nffr"},"insert":"\n"},{"insert":"4444"},{"attributes":{"table":"row-nffr"},"insert":"\n"},{"insert":"5555"},{"attributes":{"table":"row-nffr"},"insert":"\n"},{"attributes":{"table":"row-3or1"},"insert":"\n\n\n\n\n"},{"attributes":{"table":"true"},"insert":"\n\n\n\n\n"},{"insert":"\nThis text is outside the table.\n"}]

CasperNH avatar Mar 31 '24 17:03 CasperNH

is there a doc? could you beautify that code? what is "nffr" and "row-nffr" and "row-3or1"? If its easy to implement, sure why not.

nadar avatar Mar 31 '24 17:03 nadar

i need an official quill delta doc for tables, could not find anything. Post what your json values above would be expected as renderd html

nadar avatar Mar 31 '24 17:03 nadar

Great, thanks for response. :)

The "nffr" is just an identifier for the row. I dont know about the other one. I have been working on this and ended up using better-tables-plus, as the output of a regular quill tables seems to break in the first cell.

This version also covers the ability to control the width of each column.

I made a custom parser for this, which is working. Still having issue on right align. tableparser.txt

Example of table structure in Better Tables Plus: better_tables_example.txt

CasperNH avatar Apr 01 '24 11:04 CasperNH

but is there an official documentation how the delta for tables look like, so i could take a look? not sure its a good approach to implement a table support for a 3rd party library which is a fork. Maybe, if there is a documentation, we could provided it as "optional plugin" you can enable, and we name it also the same as the 3rd party library.

nadar avatar Apr 01 '24 15:04 nadar