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 @@ -3,6 +3,7 @@
## Unreleased

- Fixed a bug where the CKEditor toolbar overflow menu could be cut off within Live Preview. ([#417](https://github.com/craftcms/ckeditor/issues/417))
- Fixed a bug where the Field Limit setting was treating multibyte characters as multiple characters. ([#441](https://github.com/craftcms/ckeditor/issues/441))
- Fixed a bug where new paragraphs were getting inserted automatically after newly-added nested entries. ([#416](https://github.com/craftcms/ckeditor/issues/416))
- Fixed a JavaScript error that occurred when saving a nested entry, for an owner element that didn’t use the new element editor (like global sets). ([#419](https://github.com/craftcms/ckeditor/issues/419))

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"require": {
"php": "^8.2",
"craftcms/cms": "^5.6.0",
"craftcms/cms": "^5.6.1",
"craftcms/html-field": "^3.4.0",
"embed/embed": "^4.4",
"nystudio107/craft-code-editor": ">=1.0.8 <=1.0.13 || ^1.0.16"
Expand Down
4 changes: 3 additions & 1 deletion src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public function getElementValidationRules(): array
$rules[] = [
function(ElementInterface $element) {
$value = strip_tags((string)$element->getFieldValue($this->handle));
if (strlen($value) > $this->characterLimit) {
if (mb_strlen($value) > $this->characterLimit) {
$element->addError(
"field:$this->handle",
Craft::t('ckeditor', '{field} should contain at most {max, number} {max, plural, one{character} other{characters}}.', [
Expand Down Expand Up @@ -818,6 +818,8 @@ public function serializeValue(mixed $value, ?ElementInterface $element): mixed
return null;
}

$value = preg_replace(StringHelper::invisibleCharsRegex(), '', $value);

// Redactor to CKEditor syntax for <figure>
// (https://github.com/craftcms/ckeditor/issues/96)
$value = $this->_normalizeFigures($value);
Expand Down