2014-05-23 26 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;' 
);