下划线格式问题

Tha*_*ama 5 html format tinymce editor rte

根据文档,我想使用此设置覆盖预定义格式:

formats: {
        bold : {inline : 'b' },  
        italic : {inline : 'i' },
        underline: { inline: 'u' }
    },
Run Code Online (Sandbox Code Playgroud)

我在编辑器中插入"这是一个文本"并按下划线按钮.这是结果(这也会保存到数据库中):

<p>thi<span style="text-decoration: underline;">s is a t</span>ext</p>
Run Code Online (Sandbox Code Playgroud)

为什么我没有获得u-tag,但预定义的跨度带有下划线样式?我如何在这里获得可爱的u-tag?

编辑: 我知道u-tags已被弃用,但出于兼容性原因我需要它们!

编辑2:我的解决方案归功于公认的答案:

我能够使用legacyoutput插件中的一些代码.我使用了i nline_styles设置

inline_styles: false,
Run Code Online (Sandbox Code Playgroud)

另外我将以下代码插入我的插件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);
});
Run Code Online (Sandbox Code Playgroud)

thi*_*dot 15

这里真正的答案是:

http://tinymce.moxiecode.com/wiki.php/Plugin:legacyoutput
(见评论)


我不知道这是否正确,我只是重申我在这里找到的内容:

首先,你被警告说:

<u> 已弃用.

然后:

禁用inline_styles选项.
内联样式转换最属性为CSS样式属性-所以它会使用span标签,而不是<u>,<strike>等,所以,禁用此选项(现在是默认启用),让你在寻找的行为.

或者:

这样做:

tinyMCE.init({
    ...
    formats : {
        underline : {inline : 'u', exact : true}
        }

...
Run Code Online (Sandbox Code Playgroud)

祝好运!


csh*_*sql 9

多亏了这一点,我还需要<u>SSRS 2008报告的标签,这些标签不支持新<span style="text-decoration: underline;">标签.

这个组合对我有用:

inline_styles: false,
formats: {
    underline: { inline: 'u', exact : true }
}
Run Code Online (Sandbox Code Playgroud)