2014-05-23 44 views
0

我已經激活了Silverstripe CMS TinyMCE的字體選擇在_config.php添加此:添加額外的字體在TinyMCE字體選擇在Silverstripe

HtmlEditorConfig::get('cms')->insertButtonsBefore('formatselect', 'fontselect'); 

這個工作,現在的字體選擇器顯示。但我只能選擇基本的字體。我如何添加額外的字體到這個選擇器?例如谷歌字體?

回答

1

如果你想要這個工作一個特定的主題,只需在css文件夾中有一個editor.css並定義包含在那裏的webfont(在開始處)。

否則,你需要告訴tinyMCE的位置:

HtmlEditorConfig::get('cms')->setOption('content_css','/mysite/css/editor.css'); 

那麼你可以添加谷歌的網絡字體或任何其他字體是這樣的:

HtmlEditorConfig::get('cms')->setOption(
    'theme_advanced_fonts', 
    //left side is a custom Name to be displayed in the dropdown 
    //right side is the name of the webfont, defined in the stylesheet 
    'Name=WebfontFamily; AnotherName=AnotherWebfontFamily;' 
);