TinyMCE:选择粗体时,如何使用不同的字体而不是应用普通的粗体样式?
TinyMCE: when selecting Bold, how to use different font instead of applying normal bold style?
当我在 TinyMCE 中 select 加粗时,我想让它使用不同的字体,而不是仅仅使用当前字体的加粗变体 - 我该怎么做?
看看你的粗体文本的源代码,它可能被标记为
<strong>, <b>, <span style="*"> or else
取决于您的微型实例的设置。
知道这些后,您应该可以在编辑器样式表中设置字体了。
例如
p strong{
font-weight:400;
font-family: ...;
}
// 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
});
当我在 TinyMCE 中 select 加粗时,我想让它使用不同的字体,而不是仅仅使用当前字体的加粗变体 - 我该怎么做?
看看你的粗体文本的源代码,它可能被标记为
<strong>, <b>, <span style="*"> or else
取决于您的微型实例的设置。
知道这些后,您应该可以在编辑器样式表中设置字体了。
例如
p strong{
font-weight:400;
font-family: ...;
}
// 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
});