简体   繁体   中英

Remove the menu from insertdatetime splitbutton

I've added an insertdatetime button to my toolbar, which has an icon + a drop-down menu.

I've removed all the menu options, because I only want a single-click button, that inserts current date/time.

Is it possible to remove the drop-down (menu) part of the button?

This isn't possible out of the box, as the default button in the Insert Date/Time plugin will always use a split toolbar button. If you want just a regular toolbar button you'd need to create a custom button. Here's an example to show how this can be done by making use of the mceInsertDate command provided by the Insert Date/Time plugin: https://fiddle.tiny.cloud/9Phaab

editor.ui.registry.addButton('insertdate', {
  icon: 'insert-time',
  tooltip: 'Insert date',
  onAction: () => editor.execCommand('mceInsertDate')
});

More information can be found in the TinyMCE documentation:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM