Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- The link modal UI now reflects Craft’s native Link fields. ([#375](https://github.com/craftcms/ckeditor/pull/375))
- Added support for drag-n-drop image uploading. ([#486](https://github.com/craftcms/ckeditor/pull/486))
- Added the “Advanced Link Fields” setting to CKEditor configs. ([#375](https://github.com/craftcms/ckeditor/pull/375))
- Custom editor styles now get registered with a higher specificity than the default editor styles. ([#433](https://github.com/craftcms/ckeditor/pull/433))
- Added `craft\ckeditor\helpers\CkeditorConfig`. ([#363](https://github.com/craftcms/ckeditor/pull/363))
- Added `craft\ckeditor\web\assets\BaseCkeditorPackageAsset::$namespace`. ([#363](https://github.com/craftcms/ckeditor/pull/363))
- Added `craft\ckeditor\CkeConfig::$advancedLinkFields`.
Expand Down
10 changes: 6 additions & 4 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -1308,11 +1308,8 @@ private function _inputHtml(mixed $value, ?ElementInterface $element, bool $stat
['type' => 'module']
);

if ($ckeConfig->css) {
$view->registerCss($ckeConfig->css);
}

$value = $this->prepValueForInput($value, $element);
$inputId = Html::id('input-ckeditor-' . $id);
$html = Html::textarea($this->handle, $value, [
'id' => $id,
'class' => 'hidden',
Expand All @@ -1325,10 +1322,15 @@ private function _inputHtml(mixed $value, ?ElementInterface $element, bool $stat
]);
}

if ($ckeConfig->css) {
$view->registerCss("#{$view->namespaceInputId($inputId)} { $ckeConfig->css }");
}

return Html::tag('div', $html, [
'class' => array_filter([
$this->showWordCount ? 'ck-with-show-word-count' : null,
]),
'id' => $inputId,
'data' => [
'element-id' => $element?->id,
'config' => $this->ckeConfig,
Expand Down