TinyMCE的,允许数据属性 [英] TinyMCE, allow data attribute

查看:1054
本文介绍了TinyMCE的,允许数据属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用HTML 5 数据属性在微小的MCE,但是编辑总是很清楚它们,因为它不是由默认 valid_elements 配置的已知的属性。

I have to use the HTML 5 data attribute in Tiny MCE, but the editor always clear them, as it's not an attribute known by the default valid_elements configuration.

所以,我这里有2个问题:

So I have 2 problems here:


  • 的数据属性是动态的(也可能是数据选项,数据检验,数据富,等...),所以我需要一个通配符值什么的。

  • 我想允许所有标签的​​数据属性。

到目前为止,我已经试过:

So far, I've tried:

extended_valid_elements : '@[id|class|title|style|data-options]',

extended_valid_elements : '*[id|class|title|style|data*]',

但它不工作:(

推荐答案

extended_valid_elements 是不是在这里最好的选择。
HAVA一看 valid_elements 设置。下面是一个例子。

extended_valid_elements is not the best choice here. Hava a look at the valid_elements setting. Here is an example

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

这篇关于TinyMCE的,允许数据属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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