From 1e3fe9b34182c2a1d817dcc4d762f62e466e4132 Mon Sep 17 00:00:00 2001 From: i-just Date: Wed, 25 Mar 2026 18:42:29 +0100 Subject: [PATCH 1/2] download attribute shouldn't have a value --- src/helpers/CkeditorConfig.php | 2 +- src/web/assets/ckeditor/dist/ckeditor5-craftcms.js | 4 +++- src/web/assets/ckeditor/src/link/linkediting.js | 6 +++++- src/web/assets/ckeditor/src/link/linkui.js | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/helpers/CkeditorConfig.php b/src/helpers/CkeditorConfig.php index 6e7c9335..50d39e6f 100644 --- a/src/helpers/CkeditorConfig.php +++ b/src/helpers/CkeditorConfig.php @@ -404,7 +404,7 @@ public static function advanceLinkOptions(): array 'value' => 'download', 'conversion' => [ 'type' => 'bool', - 'value' => 'download', + 'value' => true, 'model' => 'craftDownload', 'view' => 'download', ], diff --git a/src/web/assets/ckeditor/dist/ckeditor5-craftcms.js b/src/web/assets/ckeditor/dist/ckeditor5-craftcms.js index dd2522a5..640bb990 100644 --- a/src/web/assets/ckeditor/dist/ckeditor5-craftcms.js +++ b/src/web/assets/ckeditor/dist/ckeditor5-craftcms.js @@ -1229,7 +1229,9 @@ class ju extends Hn { const C = k.textNode || k.nodeBefore; i[d.model] ? f.setAttribute( d.model, - i[d.model], + // for bool type options, if the value is set to true, set the attribute with empty value + // see https://github.com/craftcms/ckeditor/issues/551 for more info + d.type == "bool" && d.value == !0 ? "" : i[d.model], f.createRangeOn(C) ) : f.removeAttribute(d.model, f.createRangeOn(C)); } else { diff --git a/src/web/assets/ckeditor/src/link/linkediting.js b/src/web/assets/ckeditor/src/link/linkediting.js index f9f2eba1..71b4ccd0 100644 --- a/src/web/assets/ckeditor/src/link/linkediting.js +++ b/src/web/assets/ckeditor/src/link/linkediting.js @@ -113,7 +113,11 @@ export default class CraftLinkEditing extends Plugin { if (extraAttributeValues[item.model]) { writer.setAttribute( item.model, - extraAttributeValues[item.model], + // for bool type options, if the value is set to true, set the attribute with empty value + // see https://github.com/craftcms/ckeditor/issues/551 for more info + item.type == 'bool' && item.value == true + ? '' + : extraAttributeValues[item.model], writer.createRangeOn(node), ); } else { diff --git a/src/web/assets/ckeditor/src/link/linkui.js b/src/web/assets/ckeditor/src/link/linkui.js index cb7cef94..75b227ff 100644 --- a/src/web/assets/ckeditor/src/link/linkui.js +++ b/src/web/assets/ckeditor/src/link/linkui.js @@ -584,11 +584,11 @@ export default class CraftLinkUI extends Plugin { .bind('isOn') .to(linkCommand, attributeModel, (commandValue) => { if (commandValue === undefined) { - // set the initial toggle value to off after the page reload + // set the initial toggle value to "off" after the page reload formView[attributeModel].element.value = ''; return false; } else { - // set the initial toggle value to on after the page reload + // set the initial toggle value to "on" after the page reload formView[attributeModel].element.value = advancedField.conversion.value; return true; From 38281f6b5a0f1414933497ce20c04bcaef505c5f Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Mon, 30 Mar 2026 11:46:43 -0700 Subject: [PATCH 2/2] Release note [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27fd18ab..2e09b928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - New links now default to the first available link type option (usually “Entry”). ([#550](https://github.com/craftcms/ckeditor/pull/550)) - Fixed a bug where invisible characters were being stripped out of field contents. ([#537](https://github.com/craftcms/ckeditor/issues/537)) - Fixed a bug where Link modals had empty Site menus when no element was selected. ([#534](https://github.com/craftcms/ckeditor/discussions/534), [#545](https://github.com/craftcms/ckeditor/issues/545)) +- Fixed a bug where downloadable links’ `download` attributes were getting set to the value `"download"`. ([#551](https://github.com/craftcms/ckeditor/issues/551)) ## 5.3.1 - 2026-03-20