Silverstripe tinyMCE 添加自定义插件

发布于 2024-10-10 06:09:50 字数 977 浏览 3 评论 0原文

我已经下载了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

﹉夏雨初晴づ 2024-10-17 06:09:50

我现在了解到,要测试该插件是否可以在没有 Silverstripe 的情况下工作,如果可以,您可以使用这种方式将其添加到 Silverstripe 中。这对我来说就是这样的。

将插件放在 /htdocs/cms/javascript/pluginname 中。然后将以下代码添加到 /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*/

如果 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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文