leapt / froala-editor-bundle

Symfony bundle for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
11 stars 1 forks source link

Create custom plugin #26

Open jimenez-c opened 1 month ago

jimenez-c commented 1 month ago

Hello, thank you for this very good bundle!

I created a custom Froala plugin with the code from the documentation : Custom Popup

I added this custom plugin to the YML configuration using :

leapt_froala_editor:
  customJS: 'custom-plugin.js'
  pluginsEnabled: ['customPlugin']

But it seems that your bundle has a hardcoded list of available plugins, and any plugin that does not belong to this list is automatically removed.

So my question is : how do you register a custom Froala plugin with your bundle?

I managed to make it work by re-initializing all Froala instances in the custom JS with a code like this :

document.querySelectorAll('textarea').forEach(textarea => {
  new FroalaEditor(textarea, {
    pluginsEnabled: ['customPlugin'],
    toolbarButtons: ['myButton']
  })
});

but obviously it is very dirty and I have to copy/paste all YML configuration in the JS, which is not an acceptable solution.

Thank you for your help!

jmsche commented 1 month ago

Hello,

I don't see a way right now, but feel free to open a pull request :)