Silverstripe tinyMCE 添加自定义插件
我已经下载了一个 tinyMCE 插件,我想在 CMS Silverstripe 后端使用。我尝试在 mysite/_config.php 中添加该行,如 http://doc.silverstripe.org/ 中所述htmleditorconfig
HtmlEditorConfig::get('cms')->enablePlugins('../../textmetrics');
HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'TextMetrics'); // positions plugin
并将插件添加到 /sapphire/thirdparty/tinymce/plugins/textmetrics 中。
那行不通。因此,我尝试执行与 /cms/_config.php 中相同的操作,其中为编辑器设置配置并将插件放入 /cms/javascript/tinymce_textmetrics 中。然后我尝试加载
HtmlEditorConfig::get('cms')->enablePlugins(array('TextMetrics' => '../../../cms/javascript/textmetrics/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('tablecontrols', 'TextMetrics'); // positions plugin
我尝试使用 insertButtonsBefore 而不是 addButtonsToLine 只是为了看看是否有问题。
但什么也没发生......甚至没有错误消息,我不知道该怎么办。我需要加载额外的插件。
帮助表示赞赏。 谢谢斯潘基
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在了解到,要测试该插件是否可以在没有 Silverstripe 的情况下工作,如果可以,您可以使用这种方式将其添加到 Silverstripe 中。这对我来说就是这样的。
将插件放在 /htdocs/cms/javascript/pluginname 中。然后将以下代码添加到 /htdocs/cms/_config.php
如果 TinyMCE 不起作用时会抛出错误,那就太好了,但显然它不起作用。银条也没有。
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
It would be nice if TinyMCE would throw errors if it does not work, but apparently it doesn't. Neither does Silverstripe.