TinyMCE custom plugin breaking in 5.1.2

I have a custom plugin that works in Plone 5.1 but breaks in 5.1.2. I believe you updated the version of tinymce between these releases. I don't think it's a problem with my plugin.js - even if that is blank, tinymce fails to render at all if I have any value in the custom_plugins section.

The error message varies by browser and might be related to https://github.com/tinymce/tinymce/issues/3670

  • Firefox: TypeError: editor.getDoc(...) is null
  • Google Chrome: Uncaught TypeError: Cannot read property 'documentElement' of null

Has anyone been able to use a custom plugin in 5.1.2 at all? And if so, did you have to change the config on the Plone side?

it seems dubious, the issue is closed, the fix is not explicited but from the post dates it could be this release, probably
' bug where various api calls would be throwing exceptions if they where invoked on a removed editor instance.'
The Tinymce version for 5.1.1 is 4.7.6 so this particular bug should be fixed.

Currently my take on this problem is here.

Plone 5.1.4 has a new version of TinyMCE which thankfully has an error message on failed plugins that finally made the problem clear to me.

http://localhost:8082/newjersey/++plone++static/components/tinymce-builded/js/tinymce/tinymce_latex/editor_plugin.js

Obviously that's no good - that's the location of Plone's TinyMCE build and my custom plugin certainly doesn't live there. Looking in Plugins and Toolbars -> Custom Plugins I have this entry:

latex|tinymce_latex/editor_plugin.js

(This is in skins for now). So while on previous versions of plone this was taken to be a path relative to the portal root, it is now taken to be relative to the path of the tinymce build. I need to change it to

latex|../../../../../tinymce_latex/editor_plugin.js

This seems a bit silly, but it works. Is there a good reason why Plone can't assume this is relative to the portal root?

FYI the change in TinyMCE API proved to not be relevant to my case.