我将 Drupal 7 与 CKEditor 4.2 一起使用,并希望允许某些自定义内容。所以我关注了这篇文章并将以下配置添加到sites/all/modules/ckeditor/ckeditor/config.js:
CKEDITOR.editorConfig = function( config ) {
...
config.extraAllowedContent = 'pre (!command-line); span (!command); span(!comment); span(!output); em';
};
尽管如此,我在纯文本模式下通过 CKEditor 输入的以下内容仍被清除/删除:
<pre class="command-line">
<span class="command"> ... <em>...</em></span>
<span class="comment">...</span>
<span class="output">...</span>
</pre>
我也尝试使用 allowedContent 而不是 extraAllowedContent 没有任何效果。在任何一种情况下,格式都会被清除。也许我的配置被 CKEditor 忽略了,或者它本身是错误的?