Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tinymce remove other options for table plugin except the grid

enter image description here

Is it possible to remove the other options except the table grid for tinymce 4 table plugin? Id like to add the quicktable toolbar like the one in tinymce inlite theme

I have the following code currently

  tinymce.init({
        selector: 'textarea.documentWysiwyg',
        plugins: "nonbreaking table",
        menubar: false,
        toolbar: 'undo redo | bold italic | outdent indent | table',
        table_toolbar: "",
        nonbreaking_force_tab: true
    });
like image 792
bananaCute Avatar asked Mar 30 '26 17:03

bananaCute


1 Answers

We found a workaround for this issue!

You can create a new custom MenuButton (but it can be added to the toolbar!), which uses the inserttable (so called grid).

private readonly setupCallback: (editor: Editor) => void = (editor: Editor) => {
    //...
    editor.ui.registry.addMenuButton('customInsertTable', {
      icon: 'table',
      fetch: (callback) => {
        const items: any[] = [
          'inserttable'
        ];
        callback(items);
      }
    });
  };

Add the new attribute (customInsertTable) to the toolbar.

You should end up with ->

Result

like image 164
N33D Avatar answered Apr 02 '26 07:04

N33D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!