简体   繁体   English

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

[英]Enable CKEditor4 inline on span and other inline tags

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. 我想知道是否可以以及如何在<span>和其他内联元素上启用CKEditor4内联/可记录编辑功能。 This is something which I cannot find in the official docs. 这是我在官方文档中找不到的东西。

With this markup: 有了这个标记:

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

And either the standard configuration (AutoInline enabled) or this configuration: 并且标准配置(启用AutoInline)或此配置:

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

An error is reported: The specified element mode is not supported on element: "span". 报告错误: The specified element mode is not supported on element: "span". The same error is reported for <a> tags. 报告了<a>标签的相同错误。

Hack way to allow support for un supported tags: Hack方式允许支持不支持的标签:

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

Win. 赢得。

Nope. 不。 It is not possible to create editor on inline elements. 无法在内联元素上创建编辑器。 Here you can find list of accepted names. 在这里您可以找到可接受名称的列表。

However, I checked that after modifying that list I was able to initialize editor on strong element and it even works... Unless you paste or do other unsupported action :). 但是,我检查了修改该列表之后我能够在strong元素上初始化编辑器,它甚至可以工作......除非你粘贴或做其他不支持的操作:)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM