kinglozzer / htmleditorstylinghook
Allows adding CSS classes to HTMLEditorFields for styling hooks
Installs: 4 690
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 2
Language:JavaScript
Type:silverstripe-vendormodule
Requires
This package is auto-updated.
Last update: 2024-11-04 22:36:32 UTC
README
#HtmlEditorStylingHook#
A module to allow easy adding of CSS classes to SilverStripe's HtmlEditorField
instances.
###Simple example###
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; }
Currently only set up for use in the CMS. To use with a different HtmlEditorConfig
instance, simply copy the approach in _config.php