admin管理员组文章数量:1026630
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.
So I have 2 problems here:
- the data attribute is dynamic ( it could be data-options, data-test, data-foo, etc... ) So I would need a wildcard value or something.
- I want to allow the data attribute for all tags.
So far, I've tried:
extended_valid_elements : '@[id|class|title|style|data-options]',
And:
extended_valid_elements : '*[id|class|title|style|data*]',
But it doesn't work :(
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.
So I have 2 problems here:
- the data attribute is dynamic ( it could be data-options, data-test, data-foo, etc... ) So I would need a wildcard value or something.
- I want to allow the data attribute for all tags.
So far, I've tried:
extended_valid_elements : '@[id|class|title|style|data-options]',
And:
extended_valid_elements : '*[id|class|title|style|data*]',
But it doesn't work :(
Share Improve this question edited Apr 24, 2012 at 7:24 Thariama 50.8k13 gold badges145 silver badges174 bronze badges asked Oct 12, 2011 at 18:42 FMaz008FMaz008 11.3k19 gold badges70 silver badges105 bronze badges3 Answers
Reset to default 7extended_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",
I am using:
extended_valid_elements: "+@[data-options]"
and it works for me. (TinyMCE 4.3.11. Notice the + sign?)
I setup for certain element and add all necessary attributes like this
extended_valid_elements: "a[id|class|title|style|data-*|hx-*]"
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.
So I have 2 problems here:
- the data attribute is dynamic ( it could be data-options, data-test, data-foo, etc... ) So I would need a wildcard value or something.
- I want to allow the data attribute for all tags.
So far, I've tried:
extended_valid_elements : '@[id|class|title|style|data-options]',
And:
extended_valid_elements : '*[id|class|title|style|data*]',
But it doesn't work :(
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.
So I have 2 problems here:
- the data attribute is dynamic ( it could be data-options, data-test, data-foo, etc... ) So I would need a wildcard value or something.
- I want to allow the data attribute for all tags.
So far, I've tried:
extended_valid_elements : '@[id|class|title|style|data-options]',
And:
extended_valid_elements : '*[id|class|title|style|data*]',
But it doesn't work :(
Share Improve this question edited Apr 24, 2012 at 7:24 Thariama 50.8k13 gold badges145 silver badges174 bronze badges asked Oct 12, 2011 at 18:42 FMaz008FMaz008 11.3k19 gold badges70 silver badges105 bronze badges3 Answers
Reset to default 7extended_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",
I am using:
extended_valid_elements: "+@[data-options]"
and it works for me. (TinyMCE 4.3.11. Notice the + sign?)
I setup for certain element and add all necessary attributes like this
extended_valid_elements: "a[id|class|title|style|data-*|hx-*]"
本文标签: javascriptTinyMCEallow data attributeStack Overflow
版权声明:本文标题:javascript - TinyMCE, allow data attribute - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1738605251a1588734.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论