2017-01-19 11 views
0

TinyMCEでBoldを選択すると、現在のフォントの太字の変形を使用するのではなく、別のフォントを使用するようにしたいのですが、どうすればいいですか?あなたの太字テキストのソースコードでTinyMCE:太字を選択すると、通常の太字のスタイルを適用する代わりに、異なるフォントを使用する方法は?

+1

たとえば、ボールドテキスト。次に、カスタムツールバーボタンを追加する方法の簡単な例を示します。https://www.tinymce.com/docs/demo/custom-toolbar-button/ –

答えて

0
 
    

    // 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. 

 
0

見て、それはあなたの小さなインスタンスの設定に応じて

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

をマークすることができます。

これを知ったら、エディタスタイルシートでフォントを設定できるはずです。

大胆なボタンだけでは(太字テキスト)を行います...何を要求していることではありません...あなたがこれを行うには、独自のカスタムツールバーのボタンを作成する必要があります

p strong{ 
    font-weight:400; 
    font-family: ...; 
} 
関連する問題