在span和其他内联标记上启用CKEditor4内联

问题描述:

我想知道是否可以以及如何在< span> 和其他内联元素上启用CKEditor4内联/内容编辑功能。这是我在官方文档中找不到的。

I'd like to know if it's possible and how to enable the CKEditor4 inline/contenteditable editing feature on <span> and other inline elements. This is something which I cannot find in the official docs.

有了这个标记:

<span id="editable" contenteditable="true"></span>

并且标准配置(启用AutoInline)或此配置:

And either the standard configuration (AutoInline enabled) or this configuration:

<script>
    CKEDITOR.disableAutoInline = true;
    CKEDITOR.inline('editable'); // ID of the element to edit
</script>

报告错误:元素上不支持指定的元素模式: span。
< a> 标记报告同样的错误。

An error is reported: The specified element mode is not supported on element: "span". The same error is reported for <a> tags.

Hack允许支持不支持的标签的方式:

Hack way to allow support for un supported tags:

CKEDITOR.dtd.$editable.span = 1
CKEDITOR.dtd.$editable.a = 1

Win。