如何调整EpiServer 8.0 中TinyMCE 的.init 事件?

How can I adjust the .init event for TinyMCE in EpiServer 8.0?

我们需要在 CMS 中访问 TinyMCE 的 .init 事件才能调整一些设置。我们应该怎么做?这是我们希望能够执行的事情的示例。

tinymce.init({
    some_property : 'do something'
});

这样我们就可以在 TinyMCE 中调整内容过滤。我的理解是这个版本的EpiServer使用的是TinyMCE 3.9.3。感谢您的帮助。

在特定于 TinyMCE 的 EPiServer documentation 中有一个关于创建 IDynamicConfigurationOptions 实现的部分。您必须创建一个实现 IDynamicConfigurationOptions 的 class,并且在 GetConfigurationOptions() 方法中您可以 return 字典中的数据。

您可以让您的自定义 JavaScript 在 CMS UI 加载时执行,方法是在站点根目录中的 module.config 文件中添加如下内容:

<?xml version="1.0" encoding="utf-8"?>
<module>
  <clientResources>
    <add name="tinymce.custominit" path="/Path/To/Script/YourScriptFile.js" resourceType="Script" />
  </clientResources>

  <clientModule>
    <moduleDependencies>
      <add dependency="CMS" type="RunAfter" />
    </moduleDependencies>
    <requiredResources>
      <add name="tinymce.custominit" />
    </requiredResources>
  </clientModule>

</module>

YourScriptFile.js 中,您可以放置​​连接 TinyMCE 事件所需的任何脚本。

您的另一个选择是为 TinyMCE 创建一个插件,以允许您的自定义初始化代码 enabled/disabled 用于不同的 Episerver 属性。