TinyMCE:当选择粗体时,如何使用不同的字体而不是应用普通的粗体样式? [英] TinyMCE: when selecting Bold, how to use different font instead of applying normal bold style?

查看:233
本文介绍了TinyMCE:当选择粗体时,如何使用不同的字体而不是应用普通的粗体样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

解决方案

 


//获取当前编辑器
var editor = tinyMce.activeEditor;

//获取编辑器格式化程序
var f = editor.formatter;

定义我的自定义格式
var f = editor.formatter;
$ b f.register('customBold',{
inline:'span',
selector:'span,p',
styles:{fontWeight:'bold ',fontFamily:'arial'.....你的自定义风格},
});

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

editor.addButton(customBtn,{
tooltip:'My custom bold',
icon:'bold',
cmd:customBold
}) ;

不会忘记在您的tollbar中添加一个自定义的btn。



When I select Bold in TinyMCE I want to make it use a different font instead of just using the bold variant of current font - how can I do that?

解决方案

  

    // get the current editor
    var editor = tinyMce.activeEditor;

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

    define my custom format
    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)
    });

    editor.addButton(customBtn, {
        tooltip: 'My custom bold',
        icon: 'bold',
        cmd: customBold
    });

    don't forgot to add a custom btn in you tollbar.

  

这篇关于TinyMCE:当选择粗体时,如何使用不同的字体而不是应用普通的粗体样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆