Hello,
waiting for @daft answering you, i give you something i tried but it’s always a WIP test.
Maybe you could give it a try
WARNING : it is not official documentation, use it at your own risks
First you need to extend Backend\FormWidgets\RichEditor
class in your plugin’s boot
function.
RichEditor::extend(function($widget) {
$widget->addJs('/plugins/author/plugin_name/assets/js/your_javascript.js');
});
then create this /plugins/author/plugin_name/assets/js/your_javascript.js
and make something like this :
/*
|-------------------------
| Froala test Dropdown button Plugin
|-------------------------
*/
+function ($) {
oc.richEditorRegisterButton('paste', {
title: 'paste',
type: 'dropdown',
icon: '<i class="icon-clipboard"></i>',
options: {
'opt1': 'Option 1',
'opt2': 'Option 2'
},
undo: true,
focus: true,
refreshAfterCallback: true,
callback: function (cmd, val, params) {
console.log (this.html.get());
},
refresh: function ($btn) {
console.log (this.selection.element());
},
refreshOnShow: function ($btn, $dropdown) {
console.log (this.selection.element());
}
});
}(jQuery)
then, go to your backend, in editor configuration, add your command in the toolbar buttons.
you should see your new button in all your richeditor now.
Next step would be to add what you want, like a request which opens a popup, or whatever you want.
if you want you can follow the froala documentation, https://froala.com/wysiwyg-editor/docs/concepts/custom/dropdown/
About the October 3.0 Popup, i don’t find anything on how to use it on my own, but think you could use the old one until the new version is publicly released…
EDIT : i have found something, but don’t know all
you can create some new popup with something like this :
$.oc.vueComponentHelpers.inspector.host
.showModal(
'test',
['test'],
[],
'test-modal',
{
buttonText: 'apply',
resizableWidth: true
}
)
for more info about the configuration, you could take a look at modules\backend\vuecomponents\inspector\assets\js\host.js
i’ve tried to add this JS in the callback function and it opens the new modal , enjoy it
Let me know if you find some tips, i’m very interested about this feature
good luck