在Silverstripe中为TinyMCE字体选择器添加额外的字体

时间:2014-05-23 08:11:40

标签: silverstripe

我通过在_config.php中添加它来激活Silverstripe CMS TinyMCE中的字体选择器:

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

这样可行,现在显示字体选择器。但我只能选择基本字体。如何为此选择器添加额外的字体?例如谷歌字体?

1 个答案:

答案 0 :(得分:1)

如果你想让它工作一个特定的主题,只需在css文件夹中有一个editor.css并定义webfont包含在那里(在开头)。

否则你需要告诉tinyMCE位置:

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

然后你可以添加Googles webfonts或任何其他字体:

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;'
);