Is it possible to have custom Functions and commands in the TinyMCE4 Menubar?

StackOverflow https://stackoverflow.com/questions/18250656

  •  24-06-2022
  •  | 
  •  

Domanda

I have learned how to integrate custom commands in the Tiny Toolbar with the ed.addButton() Function.

Is there a similar way to add functionality to the Upper menu, the menubar ?

In the Tiny Documentation I just found how to change the order of the menu secton with this code in the init function:

menubar: "tools table format view insert edit",

È stato utile?

Soluzione

Examples :

// Adds a custom menu item to the editor that inserts contents when clicked
// The context option allows you to add the menu item to an existing default menu
tinymce.init({
   ...

   setup: function(ed) {
      ed.addMenuItem('example', {
         title: 'My menu item',
         context: 'tools',
         onclick: function() {
            ed.insertContent('Hello world!!');
         }
      });
   }
});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top