gpt4 book ai didi

javascript - CKEDITOR.config.allowedContent true 不工作

转载 作者:行者123 更新时间:2023-11-28 03:30:20 35 4
gpt4 key购买 nike

我正在使用 ckeditor。我想让用户使用他们想要的所有内联样式。

但是当我使用 CKEDITOR.config.allowedContent = true; 时,没有任何变化,ckeditor 将 style 名称更改为 [removed]

这是我尝试做的事情:

config.js

CKEDITOR.editorConfig = function( config ) { };
CKEDITOR.config.allowedContent = true;

我也试过:

CKEDITOR.editorConfig = function( config ) {    
CKEDITOR.config.allowedContent = true;
};

每次更改后我都清除了缓存,但没有成功。当我进入时

<p style="text-align: center;"><span style="color:#ff0000">this is for test</span></p>

结果变成:

<p [removed]="color:#ff0000">this is for test</span></p>

我看了很多文章,但还是没有运气。有什么建议吗?

最佳答案

关于如何在 CKEditor 中启用附加标记的简单示例

CKEDITOR.replace( 'editor1', {
extraAllowedContent: 'style;*[id,rel](*){*}'
} );

此处的 extraAllowedContent 启用该元素,允许所有(* 是通配符)已经允许的元素使用两个附加属性(在方括号中),允许为它们使用任何类名 (*) 并允许使用任何内联样式 { *

允许样式标签(style type="text/css">...</style>) :

config.extraAllowedContent = 'style';

允许任何类和任何内联样式。

config.extraAllowedContent = '*(*);*{*}';

希望对你有用!!

关于javascript - CKEDITOR.config.allowedContent true 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44773797/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com