Remove the menu from insertdatetime splitbutton - tinymce

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:
https://www.tiny.cloud/docs/plugins/opensource/insertdatetime/
https://www.tiny.cloud/docs/ui-components/typesoftoolbarbuttons/#basicbutton

Related

Create JavaFx Combobox and hide the dropdown arrow without using css

How to create a JavaFx ComboBox and hide the dropdown arrow, it should show the list only when mouse is clicked on combobox. Note- we must not use CSS

TinyMCE - customization "insert/modify table" popup

I use TinyMCE in my application. Is there any possibility to remove fields from popup, which is shown after button "Insert Table" is clicked? I would like to have only "columns" and "rows" fields.
This is not possible out of the box, but you could "customize" the template for this popup.
You can find it in /tiny_mce/plugins/table/table.htm

MenuBar non selectable sub titles

I have a horizontal menu bar with a child vertical drop-down menu bar.
I would like it so that the child vertical menu bar contains something like the following:
Title text 1
Separator 1
Option 1.1
Option 1.2
Title text 2
Separator 2
Option 2.1
Option 2.2
Is there a way to add non-selectable text into a MenuBar as I don't want the user able to select the "Title text" elements?
myTitleMenuItem.setEnabled(false) ?
As T Broyer answered u can do setEnabled(false). You will get a disabled style for the item which would not look good.
And coming to User experience, User usually expects each item in the Menu Bar to perform some action. When he sees some item with text and not performing any action on clicking, he gets a impression like 'App is not working or not responding'.
So, its always better to create a Menu Item 'Title Text' and also create a Menu Bar with required items and set this menu bar as a child or SubMenu of Title Text item.
So, whenever user hovers or clicks on the 'Title Text item' sub menu will be shown.

How to set focus on login box that render when click on sub menu bar?

I have menu bar that consist on menu and login.Each of this menu has its own sub menu.When I click on the submenu, it will render panel group layout that contain input text for login such as username and password.My question is how to set focus on the username every time i click on submenu on menu bar?
Here I attach the structure of my menu and submenu.
MENU
-Overview
LOGIN
-Employee
-Manager
Use JS to set the focus when your page loads.
Or use google and find this : https://blogs.oracle.com/jdevotnharvest/entry/how_to_programmatically_set_focus

Tinymce adding text with button

I'm trying to implement a button outside of the TinyMce editor, that would add text to the active editor upon clicking.
How can I do this?
(For example: There's a button on my website that should add "Test" into the editor, but it doesn't).
Thanks for help :)
Add this code to the onClick of your button:
// the editor id is the same id of your textarea, default "content" in case your textarea does not have an id
tinymce.get('your_editor_id').execCommand('mceInsertContent', false, "Test");
In case you have one single editor on your page you may also use tinymce.activeEditor instead of tinymce.get('your_editor_id').