kinglozzer / htmleditorstylinghook
允许为HTMLEditorFields添加CSS类以进行样式钩子操作
2.0.0
2018-06-06 09:00 UTC
Requires
This package is auto-updated.
Last update: 2024-09-04 22:10:47 UTC
README
#HtmlEditorStylingHook#
一个模块,允许轻松地为SilverStripe的HtmlEditorField
实例添加CSS类。
###简单示例###
HomePage.php
<?php use SilverStripe\Forms\FieldList; class HomePage extends Page { public function getCMSFields() { $this->beforeUpdateCMSFields(function (FieldList $fields) { if ($content = $fields->dataFieldByName('Content')) { $content->setAttribute('data-mce-body-class', 'HomePage'); } }); return parent::getCMSFields(); } }
editor.css
.HomePage { background: #000; color: #fff; }
目前仅在CMS中使用。要与其他HtmlEditorConfig
实例一起使用,只需复制_config.php
中的方法即可。