TinyMCE 和 Plone5 中缺少带字幕的图像功能

Missing captioned images feature in TinyMCE and Plone5

我缺少在 TinyMCE/Plone5 中启用带字幕图像的功能。可以使用 Plone4 (https://plone.org/documentation/manual/plone-4-user-manual/using-tinymce-as-visual-editor/images) 在控制面板中启用它。

现在我将新的 Plone5rc3 与 TinyMCE 1.4.3 一起使用,但是控制面板中的 TinyMCE 属性没有所需的复选框。

有人知道怎么弄吗? 非常感谢!

所以这里有部分答案:您需要几个条件才能使字幕起作用:

  • 您的 <img> 标签需要 class captioned。我仍然需要找到一个好的方法来做到这一点。图像选择器会在您每次打开它时删除所有其他 classes,所以我想一个好方法是更改​​ inline/left/right 选择添加的 classes,但我'很难找到它们的定义位置。

  • 你需要输出过滤器,但幸运的是,它还在。然而,过滤器想要看到一个 IImageCaptioningEnabler,它本质上是一个打开字幕机制的标志,旧的编辑器曾经有过,目前,标准 Plone 中没有任何东西提供这样的野兽。如果您对附加组件开发感到满意,您想要的 class 是

from plone.outputfilters.filters.resolveuid_and_caption import IImageCaptioningEnabler
from zope.interface import implements
class CaptioningAlwaysEnabled(object):
    implements(IImageCaptioningEnabler)

    available = True

与相应的configure.zcml

<utility factory=".resolveuid_and_caption.CaptioningAlwaysEnabled"
         name="plone5-captions-always-enabled"
         zcml:condition="have plone-5" />

(你可以看出我修补了 buildout-cache/plone.outputfilters-2.1-py2.7.egg/plone/outputfilters/filters/configure.zcmlresolveuid_and_caption.py 以包含它,但当然,你不应该那样做。)

如果您对附加组件开发不满意,您可以看看是否有其他编辑器提供了该全局开关,您不需要将其设置为您的编辑器或默认编辑器。 (Products.kupu 会,但它不会安装在 5.0 中。collective.ckeditor 可能,由于缺少依赖项,我现在无法尝试。)

所以,总结:不,你不能轻易打开它;您可以通过一些黑客攻击将其打开;如果您 file it as a feature request,对于熟悉代码的人来说,这是一种大约需要 15 分钟才能解决的问题。