This: Insert custom button on Insert/Edit Link dialog? is not working anymore with an error on this.oldOpen.apply the only available methods under editor.windowManager are:
alert()
close()
confirm()
open()
openUrl()
Able to add a custom element inside tinymce dialog box.
Changing an existing dialog opened by the link menu button
You can listen for the editor event
ExecCommand
and when its name ismceLink
(being the command fired when opening the link dialog), you can fetch the dialog iframe using specific selectors and mutate its dom to add a custom button performing your own logic.This is a full demo adding a
B
button next to the url text field:https://fiddle.tiny.cloud/NhtB7PMWnW/2
Definining your own custom dialog having buttons
When definining a dialog you are going to open with
editor.windowManager.open(...)
you have the option to use to different types of buttons:Here I'm showing how to open a dialog having both kind of buttons:
The click on any of both buttons will fire a call to the
onAction
dialog event passing itsname
in thedetails
argument.This is a working example on fiddle.tiny.cloud
https://fiddle.tiny.cloud/cPIkEAXqKj/11
The demo shared above also wraps in a layout bar the group containing the input field and the dialog button so that they will lay on a single line:
Here you can read more about layout components:
https://www.tiny.cloud/docs/tinymce/6/dialog-components/#layout-components https://www.tiny.cloud/docs/tinymce/6/dialog-components/#bar
You can find a live example covering buttons, from the official documentaion here:
https://www.tiny.cloud/docs/tinymce/6/dialog-examples/#interactive-example-using-redial