11

我在 TinyMCE 和 Plone 5 上有问题,但我不确定问题的核心是在 Plone CMS 还是 TinyMCE。

我在 TinyMCE 控制面板配置中添加自定义样式(“TinyMCE 设置”->“内联样式”)。

新的配置是这样的:

Bold|bold|bold
Italic|italic|italic
Underline|underline|underline
Strikethrough|strikethrough|strikethrough
Superscript|superscript|superscript
Subscript|subscript|subscript
Code|code|code
Custom style|customClass|custom-class

然后 TinyMCE 编辑器正确呈现菜单:

在此处输入图像描述

但是新闻条目是“禁用的”,点击它不会做任何事情。检查 TinyMCE 菜单的标记,我发现:

<div aria-checked="false" aria-disabled="true" role="menuitem" id="mceu_155" class="mce-menu-item mce-menu-item-preview mce-stack-layout-item mce-last mce-disabled" tabindex="-1">
    <i class="mce-ico mce-i-custom-class"></i>&nbsp;
    <span id="mceu_155-text" class="mce-text">Custom style</span>
</div>

所以:TinyMCE 正在禁用它。这个问题似乎与我正在使用的课程有关,而不是与我给出的名称或丢失的图标有关。如果我使用另一种样式的副本,例如...

...
Custom style|italic|custom-class

...有用。如果我使用另一个众所周知的 Plone 类,例如......

...
Custom style|discreet|custom-class

...但不知何故其他课程是不允许的。

这与 TinyMCE 内部有关吗?TinyMCE 是否以某种方式“测试”该类以启用/禁用它们?或者这个问题与Plone有关吗?

4

1 回答 1

7

经过大量调试,在模型+Plone JSON conf+TinyMCE 地狱中迷失了自己,我找到了该用例的解决方案

拥有额外的和有效的内联样式是“内联样式”配置的问题......

在此处输入图像描述

...和“格式”配置...

在此处输入图像描述

所以:您也可以通过通用设置轻松配置它,提供registry.xml如下:

<registry>

    <record name="plone.inline_styles" interface="Products.CMFPlone.interfaces.controlpanel.ITinyMCESchema" field="inline_styles">
        <value>
            <element>Bold|bold|bold</element>
            <element>Italic|italic|italic</element>
            <element>Underline|underline|underline</element>
            <element>Strikethrough|strikethrough|strikethrough</element>
            <element>Superscript|superscript|superscript</element>
            <element>Subscript|subscript|subscript</element>
            <element>Code|code|code</element>
            <element>Foo Bar Baz|foo|foo</element>
        </value>
    </record>

    <record name="plone.formats" interface="Products.CMFPlone.interfaces.controlpanel.ITinyMCESchema" field="formats">
        <value>{
    "clearfix": {
        "classes": "clearfix",
        "block": "div"
    },
    "discreet": {
        "inline": "span",
        "classes": "discreet"
    },
    "foo": {
        "inline": "span",
        "classes": "foo"
    }
}
</value>
    </record>

</registry>

注意:这与“格式”菜单的内容无关

在此处输入图像描述

++plone++static/tinymce-styles.css由于 TinyMCE importcss 插件,样式会自动从样式表中加载。

有关更多信息,请参见https://github.com/plone/Products.CMFPlone/issues/492https://github.com/plone/Products.CMFPlone/issues/1264

于 2015-11-26T17:30:05.433 回答