SilverStripe-编辑器上的“样式”下拉菜单中添加样式
-
22-09-2019 - |
题
从上面的问题来看,我认为这相对容易,但是我找不到有关如何在“样式”下拉菜单中添加样式的任何文档。谁能向我推动正确的方向?
解决方案
样式下拉菜单将根据主题版本中的类别自动填充。CSS文件。要添加类,只需确保在那里定义它们即可。另外,如果您想给出类更友好的名称或从列表中删除某些类 _config.php
文件。
HtmlEditorConfig::get('cms')->setOption('theme_advanced_styles',
'Name 1=class1;Name 2=class2');
这是Tinymce提供的功能,Wysiwyg编辑器组件,此行只是设置 theme_advanced_styles
CMS使用时的Tinymce设置。 Tinymce网站上的此线程 也讨论了它。
Also note Markus' answer below: editor.css needs to be in the theme css folder and include the 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.
这是更多 详细说明 这两个如何一起玩。
如果您遇到麻烦,将新样式出现在编辑器中,请尝试以下内容:
- yoursite.com/admin/?flush=1
- 在您的mythemes/css/editor.css文件上查看文件权限。 Web服务器用户应该可以阅读它。
不隶属于 StackOverflow