CKEditor在选择标记

时间:2015-04-23 14:10:50

标签: javascript ckeditor

我正在尝试将内联样式直接添加到选择文本标记中,例如 我在foo中选择了<a>foo</a>,然后点击粗体按钮。 目前我的配置已完成:

coreStyles_bold: {
  element: 'b',
  overrides: 'span',
  styles: { 'font-weight': 'bold' },
  childRule: function() {
    return false;
  }
}

会将我的<a>foo</a>转换为

<a><span style="font-weight: bold;">foo</span></a>

我想实现:

<a style="font-weight: bold;">foo</a>

这在CKEditor中是否可行?

1 个答案:

答案 0 :(得分:1)

虽然它可能与否,但它没有意义。让我们说用户能够做到这一点:

bar <a style="font-weight: bold;">foo</a> bar

现在,用户选择foo的一部分和bar的一部分并删除粗体...

bar <a style="font-weight: bold;">f[oo</a> ba]r

现在会发生什么?

bar <a style="font-weight: bold;">f</a><a>oo</a> bar

最终用户会认为有两个不同的链接......

相关问题