Now when creating a table:
<table style = "width: 100%;">
<tbody>
<tr>
...
</tr>
</tbody>
</table>
How to set the default class when creating a table?
<table class="my-custom-class" style="width: 100%;">
<tbody>
<tr>
...
</tr>
</tbody>
</table>
We don't have such an option, however what you could do is to listen to the commands.before and commands.after to find the newly inserted table. To find the tables inside the editor, you could do the following inside the callbacks:
editor.$el.find('table');
Seconding that we'd like the option to easily customize the attrs of the generated table.
@stefanneculai How do I find the newly inserted table if there are already other tables in the editor?
For example when inserting multiple tables, or for nested tables (email).
Latest commit adds the table.inserted event and creates the possibility to get the inserted table easily:
$(selector).froalaEditor({
}).on('froalaEditor.table.inserted', function (e, editor, table) {
console.log(table);
});
Wow, thanks! That's excellent! :)
I was literally needing this yesterday, and came back and it's solved. 馃憤
Most helpful comment
Latest commit adds the
table.insertedevent and creates the possibility to get the inserted table easily: