Wysiwyg-editor: The default settings for table

Created on 26 Jun 2017  路  6Comments  路  Source: froala/wysiwyg-editor

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>

Most helpful comment

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);
});

All 6 comments

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. 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adilsonb picture adilsonb  路  3Comments

horatiua picture horatiua  路  4Comments

isubasti picture isubasti  路  4Comments

Krisell picture Krisell  路  3Comments

bnjmnfnk picture bnjmnfnk  路  4Comments