简体   繁体   English

TinyMCE 移除 HTML 元素

[英]TinyMCE Removing HTML Elements

I'm writing contents that has example HTML tags in it.我正在编写包含示例 HTML 标记的内容。

I've already tried all these attributes:我已经尝试了所有这些属性:

tinyMCE.init({
    // ...
       cleanup: false,
       cleanup_on_startup: false,
       verify_html: false,
       extended_valid_elements : '*[*]',
});

After saving, everything is OK:保存后一切正常: 保存后

But when I reopen it, TinyMCE deletes all the HTML tags in my text:但是当我重新打开它时,TinyMCE 会删除我文本中的所有 HTML 标签: 重新打开

How is the content being stored in your database?内容如何存储在您的数据库中?

If you want to use a code example that includes HTML, you must use HTML entities for your < and >.如果要使用包含 HTML 的代码示例,则必须为 < 和 > 使用 HTML 实体。 If you don't do this, it will be interpreted as actual HTML.如果您不这样做,它将被解释为实际的 HTML。

&lt;title&gt;Example Title&lt;/title&gt;

Also, have you looked into TinyMCE's Code Sample plugin to show code examples?另外,您是否查看过 TinyMCE 的代码示例插件以显示代码示例? https://www.tiny.cloud/docs/plugins/opensource/codesample/ https://www.tiny.cloud/docs/plugins/opensource/codesample/

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

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