How can I initialize table in quill js 2.0.?
I've tried by using table keyword in toolbar it shows table icon but I could not create the table.
How can I initialize table in quill js 2.0.?
I've tried by using table keyword in toolbar it shows table icon but I could not create the table.
Share Improve this question edited Sep 14, 2018 at 12:25 Ivar 6,81812 gold badges56 silver badges67 bronze badges asked Sep 14, 2018 at 12:22 Agustine RajAgustine Raj 1811 gold badge1 silver badge5 bronze badges 1- Did you ever find a solution that allowed you to use the table module from controls in the toolbar? – Jason Wood Commented Jun 13, 2020 at 15:17
2 Answers
Reset to default 8Try to provide table module when creating your editor like this:
var editor = new Quill( '#editor', {
theme: 'snow',
modules: {
table: true
}
} );
And then just reference table module:
const table = editor.getModule('table');
Using table variable you can trigger different methods for tables:
table.insertTable(2, 2);
Full example can be found here: https://codepen.io/quill/pen/QxypzX
I really like the extensibility of Quill a lot. I implement a module quill-better-table to add support for tables. Hope that quill-better-table could help someone who need to edit/render table in quilljs. Requirements: quill.js v2.0.0-dev.3