TinyMCE 正在删除 html 的某些部分 [英] TinyMCE is removing some part of html

查看:37
本文介绍了TinyMCE 正在删除 html 的某些部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够插入空的 div 和 span 元素,比如 [something] 之类的文本,但是当我保存 TinyMCE 时会删除所有这些代码.

I want to be able to insert empty div and span elements, text like [something], but when I save TinyMCE is removing all this code.

是否有一个配置选项可以告诉 TinyMCE 返回我输入的确切文本?

Is there a config option that tells TinyMCE to return me the exact text I've entered?

谢谢.

推荐答案

是的,您需要将 valid_elements 配置选项更改为类似的内容

Yes, you need to change your valid_elements config option to somethin like

    // The valid_elements option defines which elements will remain in the edited text when the editor saves.
    valid_elements: "@[id|class|title|style|onmouseover]," +
    "a[name|href|target|title|alt]," +
    "p,blockquote,-ol,-ul,-li,br,img[src|height|width],-sub,-sup,-b,-i,-u," +
    "span[data-mce-type],hr",

重要的是,'P' 和 'span' 元素之前没有减号.

Iportant here is that the 'P' and 'span' elements does not have a minus standing right before.

这篇关于TinyMCE 正在删除 html 的某些部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆