Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Can I use other WYSIWYG editors besides Quill for DataTables


Can I use other WYSIWYG editors besides Quill for DataTables


it appears that you can use other WYSIWYG editors besides Quill with Yajra DataTables. Here are a few examples:

TinyMCE

The search results mention that there is a TinyMCE plugin for the DataTables Editor library:

php
return DataTables::of(User::select())
    ->addColumn('bio', function($user) {
        return $.fn.dataTable.render.editor.tinymce($user->bio);
    })
    ->toJson();

This allows you to use the TinyMCE WYSIWYG editor for the `bio` column.

Froala

The search results also mention the Froala WYSIWYG editor, and that there is no official plugin yet, but it should be possible to integrate it:

php
return DataTables::of(User::select())
    ->addColumn('bio', function($user) {
        return '<div class="froala-editor">' . $user->bio . '</div>';
    })
    ->rawColumns(['bio'])
    ->toJson();

In this case, you would need to initialize the Froala editor on the `.froala-editor` elements in your table.

Custom WYSIWYG Editors

The search results suggest that you can integrate any WYSIWYG editor you want, as long as you can render the HTML output correctly in your DataTables columns.

For example, if you're using a custom WYSIWYG editor, you can render the HTML output in your column definition:

php
return DataTables::of(User::select())
    ->addColumn('bio', function($user) {
        return $user->bio_html; // Assuming you have pre-rendered the HTML output
    })
    ->rawColumns(['bio'])
    ->toJson();

The key points are:

1. You can use various WYSIWYG editors like TinyMCE and Froala with Yajra DataTables.
2. For editors with official plugins, you can use the provided rendering functions.
3. For custom WYSIWYG editors, you can render the HTML output directly in your column definitions.
4. Remember to use `rawColumns()` to ensure the HTML is rendered correctly in the table.

So in summary, you have flexibility in choosing the WYSIWYG editor that best fits your needs and integrating it with Yajra DataTables.

Citations:
[1] https://datatables.net/forums/discussion/53437/datatables-editor-wysiwyg-editor
[2] https://github.com/gollum/gollum/issues/1377
[3] https://editor.datatables.net/plug-ins/field-type/editor.tinymce
[4] https://datatables.net/forums/discussion/65792/froala-wysiwyg-editor
[5] https://datatables.net/forums/discussion/17356/wysiwyg-for-editor