2
votes

I've downloaded a plugin for tinyMCE I want to use in the CMS Silverstripe backend. I've tried to add the line in mysite/_config.php as told in http://doc.silverstripe.org/htmleditorconfig

HtmlEditorConfig::get('cms')->enablePlugins('../../textmetrics');
HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'TextMetrics'); // positions plugin

And added the Plugin into /sapphire/thirdparty/tinymce/plugins/textmetrics.

That didn't work. So I tried to do the same as in /cms/_config.php where the configuration is set for the editor and put the plugin into /cms/javascript/tinymce_textmetrics. Then I tried to load with

HtmlEditorConfig::get('cms')->enablePlugins(array('TextMetrics' => '../../../cms/javascript/textmetrics/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('tablecontrols', 'TextMetrics'); // positions plugin

I've tried to use insertButtonsBefore insteat of addButtonsToLine just to see if there was a problem.

But nothing happens at all.... not even errormessages and I don't know what to do. I need extra plugins to load.

Help appreciated. Thx Spanky

1
Hi! This is just a shot in the dark, but this may very well be a caching problem... have you tried if you can output anything, like adding die('Hey!'); to your config file?Spiny Norman
Hi,not a caching problem. I've turned the cache off with SSViewer::flush_template_cache(); And your die() worksspankmaster79
Does your plugin work without Silverstripe? I have a testpage without the CMS i use tinymce in, to test if an error is CMS-related or not.Thariama
I've testet that now and it seems like the plugin is broken. When I try to load it without Silverstripe it doesn't load.spankmaster79

1 Answers

3
votes

I've learned now, to test if the plugin works without Silverstripe and if it does, you can use this way to add it in Silverstripe. This is how it worked for me.

Put the Plugin in /htdocs/cms/javascript/pluginname . Then add the following code to /htdocs/cms/_config.php

HtmlEditorConfig::get('cms')->enablePlugins(array('pluginname' => '../../../cms/javascript/pluginname/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('tablecontrols', 'pluginname'); // positions plugin*/

It would be nice if TinyMCE would throw errors if it does not work, but apparently it doesn't. Neither does Silverstripe.