TinyMCE:选择Bold时,如何使用不同的字体而不是应用普通的粗体样式?

问题描述 投票:0回答:2

当我在TinyMCE中选择Bold时,我想让它使用不同的字体而不是仅使用当前字体的粗体变体 - 我该怎么做?

fonts tinymce tinymce-4
2个回答
0
投票
// get the current editor
var editor = tinyMce.activeEditor;

// get the editor formatter
var f = editor.formatter;

f.register('customBold', {
    inline: 'span',
    selector: 'span,p',
    styles: { fontWeight: 'bold',fontFamily: 'arial'.....your custom style },
});

editor.addCommand('customBold',function(){
    editor.applyFormat(name)
});

// add a button in the toolbar
editor.addButton(customBtn, {
    tooltip: 'My custom bold',
    icon: 'bold',
    cmd: customBold
});

0
投票

查看粗体文本的源代码,可以标记

<strong>, <b>, <span style="*"> or else

取决于您的Tiny Instance的设置。

当您知道这一点时,您应该能够在编辑器样式表中设置字体。

例如

p strong{
  font-weight:400;
  font-family: ...;
}
© www.soinside.com 2019 - 2024. All rights reserved.