Reputation: 181
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.
Upvotes: 18
Views: 37169
Reputation: 41
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
Upvotes: 4
Reputation: 1087
Try 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
Upvotes: 8