silverstripe - 在编辑器的“样式"下拉菜单中添加样式 [英] silverstripe - adding styles to 'styles' drop down menu on editor

查看:30
本文介绍了silverstripe - 在编辑器的“样式"下拉菜单中添加样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从上面的问题来看,我认为这会相对容易,但我找不到有关如何向样式"下拉菜单添加样式的任何文档.谁能把我推向正确的方向?

from the question above, I thought it would be relatively easy but i can not find any documentation on on how to add styles to the 'styles' drop down menu. can anyone push me in the right direction?

推荐答案

样式下拉列表会根据主题的typography.css 文件中的类自动填充.要添加类,只需确保在那里定义它们.或者,如果您想为类提供更友好的名称或从列表中删除一些类,您可以通过将其放入 _config.php 文件来明确定义您想要列出的样式.

The styles dropdown is automatically populated based on classes found in your theme's typography.css file. To add classes, just ensure that they are defined there. Alternatively, if you want to give the classes friendlier names or to remove some classes from the list, you can explicitly define the styles that you want listed by putting this in your _config.php file.

HtmlEditorConfig::get('cms')->setOption('theme_advanced_styles', 
    'Name 1=class1;Name 2=class2');

这是 TinyMCE 提供的功能,WYSIWYG 编辑器组件,这一行只是设置 TinyMCE 在 CMS 使用时的 theme_advanced_styles 设置.TinyMCE 网站上的这个主题也讨论了它.

It's a feature provided by TinyMCE, the WYSIWYG editor component, and this line is just setting the theme_advanced_styles setting of TinyMCE when used by the CMS. This thread on the TinyMCE site also discusses it.

另请注意下面 Markus 的回答:editor.css 需要在主题 css 文件夹中并包含 Typography.css.

Also note Markus' answer below: editor.css needs to be in the theme css folder and include the typography.css.

这篇关于silverstripe - 在编辑器的“样式"下拉菜单中添加样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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