admin管理员组文章数量:1335107
In CKEditor there are allowedContent
and extraAllowedContent
options in the config. I understand how allowedContent
allows you to say what tags and attributes will be left by the ACF but why is there allowedContent
and extraAllowedContent
? Don't they do the same thing?
One thing I have found is when wanting to allow iframes it only seems to work if you put iframe[*]
in extraAllowedContent
; it does not work if you put it in allowedContent
.
Why? What is the difference?
In CKEditor there are allowedContent
and extraAllowedContent
options in the config. I understand how allowedContent
allows you to say what tags and attributes will be left by the ACF but why is there allowedContent
and extraAllowedContent
? Don't they do the same thing?
One thing I have found is when wanting to allow iframes it only seems to work if you put iframe[*]
in extraAllowedContent
; it does not work if you put it in allowedContent
.
Why? What is the difference?
Share Improve this question asked Oct 26, 2017 at 7:35 texelatetexelate 2,5083 gold badges26 silver badges32 bronze badges1 Answer
Reset to default 8Setting allowedContent
manually instructs the editor to ignore pletely the allowed markup specified by enabled plugins (e.g. the list plugin "registers" <ul>
and <li>
tags). It may result in removing features from CKEditor. For example if you use the Standard preset and you allow just iframe[*]
, then most of the buttons will "disappear" (like Bold, List, Table) fro the toolbar, because you no longer allow elements like <strong>
, <ul>
, <li>
and so on.
extraAllowedContent
, as the name suggests, lets you extend the list of allowed tags/attributes that CKEditor will allow by default. What CKEditor supports by default directly depends on what features you did enable.
The following link explains it really well: https://docs.ckeditor./ckeditor4/docs/#!/guide/dev_acf
One thing I have found is when wanting to allow iframes it only seems to work if you put iframe[*] in extraAllowedContent; it does not work if you put it in allowedContent.
It looks like you made a mistake in the code because I just checked that case and it works as expected (the iframe element is left in the content, all other markup is removed, most of the toolbar buttons disappeared).
Last but not least, instead of just enabling the iframe element with extraAllowedContent, consider adding another plugin to CKEditor that correctly handles editing iframes (https://ckeditor./cke4/addon/iframe). If you add it to your build, it will automatically allow <iframe>
elements.
版权声明:本文标题:javascript - What is the difference between allowedContent and extraAllowedContent in CKEditor? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742383357a2464537.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论