下划线格式问题
根据 文档 我想使用此设置覆盖预定义格式:
formats: {
bold : {inline : 'b' },
italic : {inline : 'i' },
underline: { inline: 'u' }
},
我将“这是文本”插入编辑器并按下划线按钮。 这是结果(这也保存到数据库):
<p>thi<span style="text-decoration: underline;">s is a t</span>ext</p>
为什么我没有得到 u 标签,而是带有下划线样式的预定义范围? 我如何在这里获得我可爱的 u 标签?
编辑: 我确实知道 u 标签已被弃用,但出于兼容性原因我需要它们!
编辑2:我的解决方案感谢接受的答案:
我能够使用legacyoutput插件中的一些代码。我使用了 inline_styles 设置
inline_styles: false,
另外,我还在我的一个插件 onInit 中添加了以下代码
serializer = ed.serializer;
// Force parsing of the serializer rules
serializer._setup();
// Check that deprecated elements are allowed if not add them
tinymce.each('b,i,u'.split(','), function(name) {
var rule = serializer.rules[name];
if (!rule) serializer.addRules(name);
});
According to the documentation i would like to overwrite predefined formats using this settings:
formats: {
bold : {inline : 'b' },
italic : {inline : 'i' },
underline: { inline: 'u' }
},
I insert "this is a text" into the editor and press the underline-button.
This is the result (this gets saved to database too):
<p>thi<span style="text-decoration: underline;">s is a t</span>ext</p>
Why do i get no u-tags, but the predefined span with underlined style?
How do i get my lovely u-tags here?
EDIT: I do know that u-tags are deprecated, but i need them for compatibility reasons!
EDIT2: My solution thanks to the accepted answer:
I was able to use some code from the legacyoutput plugin. I used the inline_styles setting
inline_styles: false,
additionally ia dded the following code into one of my plugins onInit
serializer = ed.serializer;
// Force parsing of the serializer rules
serializer._setup();
// Check that deprecated elements are allowed if not add them
tinymce.each('b,i,u'.split(','), function(name) {
var rule = serializer.rules[name];
if (!rule) serializer.addRules(name);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这里真正的答案是:
http://tinymce.moxiecode.com/wiki.php/Plugin:legacyoutput
(见评论)
我不知道这是否正确,我只是重申我的在此处找到:
首先,我们警告您:
然后:
或者:
祝你好运!
The real answer here turned out to be:
http://tinymce.moxiecode.com/wiki.php/Plugin:legacyoutput
(see comments)
I don't know whether this is correct, I'm just reiterating what I found here:
Firstly, you're warned that:
Then:
Alternatively:
Good luck!
谢谢,我还需要 SSRS 2008 报告的
标签,该标签不支持新的
标签。
这种组合对我有用:
Thanks for this, I also need the
<u>
tags for SSRS 2008 reports which do not support the new<span style="text-decoration: underline;">
tag.This combination worked for me:
在这里工作吗?
http://jsfiddle.net/dFY6r/
另外
u
标签已被弃用,与b
和i
这就是我们现在使用 CSS 的原因:Works here?
http://jsfiddle.net/dFY6r/
Also
u
tags are deprecated, along withb
andi
that is why we use CSS now: