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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

- Added the “Field Limit” field setting, which can be set to a character limit or word limit. ([#384](https://github.com/craftcms/ckeditor/pull/384))
- Added the “GraphQL Mode” field setting. ([#403](https://github.com/craftcms/ckeditor/pull/403))
- Editor toolbars now have dedicated nested entry creation buttons, for entry types that have icons. Any entry types that don’t have an icon are now grouped into a “+” menu. ([#404](https://github.com/craftcms/ckeditor/pull/404))
- Improved the styling of CKEditor fields. ([craftcms/cms#17164](https://github.com/craftcms/cms/discussions/17164))
- The “Anchors” CKEditor plugin has been replaced with CKEditor’s new built-in [Bookmarks](https://ckeditor.com/docs/ckeditor5/latest/features/bookmarks.html) plugin. ([#397](https://github.com/craftcms/ckeditor/pull/397))
- Removed the “‘New’ Button Label” field setting. ([#404](https://github.com/craftcms/ckeditor/pull/404))
- Updated to CKEditor 5 45.0.0. ([#397](https://github.com/craftcms/ckeditor/pull/397))
- Added `craft\ckeditor\Field::$characterLimit`.
- Added `craft\ckeditor\Field::$fullGraphqlData`.
Expand Down
21 changes: 3 additions & 18 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ private static function adjustFieldValues(
/**
* @var string|null The “New entry” button label.
* @since 4.0.0
* @deprecated in 4.8.0
*/
public ?string $createButtonLabel = null;

Expand Down Expand Up @@ -593,7 +594,7 @@ public function getContentGqlType(): Type|array
*/
public function settingsAttributes(): array
{
$attributes = parent::settingsAttributes();
$attributes = ArrayHelper::without(parent::settingsAttributes(), 'createButtonLabel');
$attributes[] = 'entryTypes';
return $attributes;
}
Expand Down Expand Up @@ -734,7 +735,6 @@ public function getSettingsHtml(): ?string
'value' => null,
],
], $transformOptions),
'defaultCreateButtonLabel' => $this->defaultCreateButtonLabel(),
]);
}

Expand Down Expand Up @@ -972,7 +972,6 @@ protected function inputHtml(mixed $value, ?ElementInterface $element, $inline):
'accessibleFieldName' => $this->_accessibleFieldName($element),
'describedBy' => $this->_describedBy($view),
'entryTypeOptions' => $this->_getEntryTypeOptions(),
'createButtonLabel' => $this->createButtonLabel(),
'findAndReplace' => [
'uiType' => 'dropdown',
],
Expand Down Expand Up @@ -1341,6 +1340,7 @@ private function _getEntryTypeOptions(): array
$entryTypeOptions = array_map(
fn(EntryType $entryType) => [
'icon' => $entryType->icon ? Cp::iconSvg($entryType->icon) : null,
'color' => $entryType->getColor()?->value,
'label' => Craft::t('site', $entryType->name),
'value' => $entryType->id,
],
Expand All @@ -1350,21 +1350,6 @@ private function _getEntryTypeOptions(): array
return $entryTypeOptions;
}

private function createButtonLabel(): string
{
if (isset($this->createButtonLabel)) {
return Craft::t('site', $this->createButtonLabel);
}
return $this->defaultCreateButtonLabel();
}

private function defaultCreateButtonLabel(): string
{
return Craft::t('app', 'New {type}', [
'type' => Entry::lowerDisplayName(),
]);
}

/**
* Fill entry card CKE markup (<craft-entry data-entry-id="96"></craft-entry>)
* with actual card HTML of the entry it's linking to
Expand Down
10 changes: 0 additions & 10 deletions src/templates/_field-settings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,6 @@
data: {'error-key': 'entryTypes'},
}) }}

{{ forms.textField({
label: '“New” Button Label'|t('app'),
instructions: 'The text label for the entry creation button.'|t('app'),
id: 'create-button-label',
name: 'createButtonLabel',
value: field.createButtonLabel,
placeholder: defaultCreateButtonLabel,
errors: field.getErrors('createButtonLabel')
}) }}

<hr>

<a class="fieldtoggle" data-target="assets">{{ 'Assets'|t('app') }}</a>
Expand Down
3 changes: 3 additions & 0 deletions src/translations/en/ckeditor.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

return [
'Add nested content' => 'Add nested content',
'Advanced' => 'Advanced',
'Available Transforms' => 'Available Transforms',
'CKEditor Config' => 'CKEditor Config',
Expand Down Expand Up @@ -40,6 +41,7 @@
'Site: {name}' => 'Site: {name}',
'The default transform that should be applied when inserting an image.' => 'The default transform that should be applied when inserting an image.',
'The maximum number of words or characters the field is allowed to have.' => 'The maximum number of words or characters the field is allowed to have.',
'The text tooltip for the entry creation button.' => 'The text tooltip for the entry creation button.',
'The transforms that should be available when inserting images.' => 'The transforms that should be available when inserting images.',
'The type of column this field should get in the database.' => 'The type of column this field should get in the database.',
'This field doesn’t allow nested entries.' => 'This field doesn’t allow nested entries.',
Expand All @@ -53,4 +55,5 @@
'{attribute} isn’t valid JSON.' => '{attribute} isn’t valid JSON.',
'{field} should contain at most {max, number} {max, plural, one{character} other{characters}}.' => '{field} should contain at most {max, number} {max, plural, one{character} other{characters}}.',
'{field} should contain at most {max, number} {max, plural, one{word} other{words}}.' => '{field} should contain at most {max, number} {max, plural, one{word} other{words}}.',
'“+” Button Tooltip' => '“+” Button Tooltip',
];
2 changes: 1 addition & 1 deletion src/web/assets/ckeditor/dist/ckeditor5-craftcms.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/ckeditor/dist/ckeditor5-craftcms.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/ckeditor/dist/css/ckeditor5-craftcms.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading