How to load TinyMCE Plugin "template" in Plone 6 beta 1?

In Plone 5 and until 6 alpha4 the I had this in my profiles/default/registry.xml:

  <records interface="plone.base.interfaces.controlpanel.ITinyMCESchema" prefix="plone">    
    <value key="custom_plugins">
      <element>template|++plone++static/components/tinymce-builded/js/tinymce/plugins/template</element>
    </value>
  </records>

It loads the template plugin which is handy if one needs to insert more complex HTML in TinyMCE. The HTML snippets are stored in the theme folder.
Now in Plone 6 beta 1 it does not work anymore.

Whats the right way now to load the templates plugin?

In Plone 6 th template plugin is included in the plugins already. All you have to do is to enable it via checkbox in the control panel and define your list templates as usual.

2 Likes

Thanks. Now I have a different error. Then "Insert template" -> modal pops up, greyed out, spinner running and in browser console:

Uncaught (in promise) TypeError: e is undefined in plugin.js

I tested on https://6-classic.demo.plone.org - same effect.

I now stumbled over the same problem. The cause was properly a change in the TinyMCE template plugin. It's revealed when running Mockup with the webpack development server with yarn start and using the url http://localhost:8000/bundle.min.js in the resource registry for debugging.
However.

You can simply fix it by adding a "description" to your templates. This is an example TinyMCE schema registry.xml snippet:

  <records interface="Products.CMFPlone.interfaces.controlpanel.ITinyMCESchema"
           prefix="plone">
    <value key="plugins" purge="False">
      <element>template</element>
    </value>
    <value key="custom_plugins" purge="True">
    </value>
    <value key="templates">
        [
            {"title": "Something", "description": "", "url": "++plone++my.site/tinymce_templates/something.html"},
            {"title": "Else", "description": "", "url": "++plone++my.site/tinymce_templates/else.html"}
        ]
    </value>
  </records>
3 Likes