[Bug]: TinyMCE cannot be configured as documented because some plugins are missing
Pimcore version
11.2.3
Steps to reproduce
The Pimcore documentation for the TinyMCE Bundle links to the toolbar documentation page on the TinyMCE website.
Follow the instructions to include some configuration, in my case I want to use the anchor plugin, but many other plugins seem to be affected too.
Our configuration:
{ "toolbar1": "undo redo | removeformat code | link unlink | anchor", "toolbar2": "bold subscript superscript | bullist numlist", "paste_as_text": true, "plugins": [ "paste", "link", "anchor" ] }
Actual Behavior
Many plugins don't work, there will be JavaScript errors like for example:
Failed to load plugin: paste from url plugins/paste/plugin.min.js hS @ admin/misc/script-pr…ea4fe3eb8f505:12333 Failed to load plugin: anchor from url plugins/anchor/plugin.min.js hS @ admin/misc/script-pr…ea4fe3eb8f505:12333
Expected Behavior
The toolbar configuration options as described in the documentation can be used.
It seems that the TinyMCE Bundle in Pimcore does not provide all of the plugins available for TinyMCE. If that is the case there should be documentation that clearly lists all useable plugins. Ideally there should be a description on how to add missing plugins in case the desired plugin is not part of the Pimcore Bundle.
Same problem with the same Pimcore version as above, the plugin searchreplace is also not available or is not loaded.
Thank you for reporting!
It seems that there are no plugins shipped with Pimcore by default, beside a help one
https://github.com/pimcore/pimcore/tree/11.x/bundles/TinymceBundle/public/build/tinymce/plugins
So to make it work, devs need to "copy" the official ones provided from TinyMCE that they specifically need for their projects and use this addonManager (and set a public path outside the pimcore repository folder)
https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.addonmanager/#examples-2
Can anybody please try it and provide a PR with examples and instructions for it? Thank you in advance
Thank you for reporting! It seems that there are no plugins shipped with Pimcore by default, beside a
helpone https://github.com/pimcore/pimcore/tree/11.x/bundles/TinymceBundle/public/build/tinymce/pluginsSo to make it work, devs need to "copy" the official ones provided from TinyMCE that they specifically need for their projects and use this
addonManager(and set a public path outside the pimcore repository folder) https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.addonmanager/#examples-2Can anybody please try it and provide a PR with examples and instructions for it? Thank you in advance
@kingjia90 Your proposed solution worked for me.
In addition it's also possible using the external_plugins option instead after downloading the official plugins.
As an example (downloaded plugins placed in a bundle):
{
... ,
plugins: '... searchreplace quickbars ...',
external_plugins: {
'searchreplace': '/bundles/BUNDLE_NAME/js/tinymce/v6.8.3/plugins/searchreplace/plugin.min.js',
'quickbars': '/bundles/BUNDLE_NAME/js/tinymce/v6.8.3/plugins/quickbars/plugin.min.js'
},
...
}
Tested on Pimcore 11.2.3 with TinyMCE 6.8.3.
@olivermerz Thank you for letting me know, it's also nice to learn about external_plugins which makes it more easy to read/manage and looks less "global".
Switching this issue from Bug to Task, any volunteers for creating a nice documentation PR with examples? 😃 Thank you in advance
Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.
Resolved by #17709