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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
样式下拉列表会根据主题的typography.css 文件中找到的类自动填充。要添加类,只需确保它们已在那里定义即可。或者,如果您想为类提供更友好的名称或从列表中删除某些类,您可以通过将其放入
_config.php
文件中来显式定义要列出的样式。这是TinyMCE(WYSIWYG 编辑器组件)提供的功能,这一行只是设置TinyMCE 在CMS 使用时的
theme_advanced_styles
设置。 TinyMCE 站点上的这个帖子 也对此进行了讨论。另请注意下面 Markus 的回答: editor.css 需要位于主题 css 文件夹中并包含typography.css。
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.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.Also note Markus' answer below: editor.css needs to be in the theme css folder and include the typography.css.
@Sam Minnée 的答案只有在 editor.css 也在主题 css 文件夹中并且包含typography.css 的情况下才有效。
这是更详细说明 这两个如何一起玩。
如果您在编辑器中显示新样式时遇到问题,请尝试以下操作:
The answer of @Sam Minnée only works, if the editor.css is also in the theme css folder and includes the typography.css.
Here is a more detailed description of how these two play together.
If you have troubles getting the new styles appear in the editor, try the following: