diff --git a/CHANGELOG.md b/CHANGELOG.md index 76821281..a3c55f02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Added Dutch translations. ([#603](https://github.com/craftcms/ckeditor/pull/603)) - Improved Norwegian translations. ([#601](https://github.com/craftcms/ckeditor/pull/601), [#602](https://github.com/craftcms/ckeditor/pull/602)) - Fixed a bug where selected image transforms were being forgotten, if the transform chanegd the file format. ([#588](https://github.com/craftcms/ckeditor/issues/588)) +- Fixed a bug where downloadable links’ `download` attributes were sometimes getting set to the value `"true"`. ([#606](https://github.com/craftcms/ckeditor/issues/606)) ## 5.6.1 - 2026-05-13 diff --git a/src/web/assets/ckeditor/dist/ckeditor5-craftcms.js b/src/web/assets/ckeditor/dist/ckeditor5-craftcms.js index 8e8418e0..2d32e861 100644 --- a/src/web/assets/ckeditor/dist/ckeditor5-craftcms.js +++ b/src/web/assets/ckeditor/dist/ckeditor5-craftcms.js @@ -1340,7 +1340,9 @@ class Uu extends $n { for (const h of C) 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/606 for more info + d.type == "bool" && d.value == !0 ? "" : i[d.model], h ) : f.removeAttribute(d.model, h); } diff --git a/src/web/assets/ckeditor/src/link/linkediting.js b/src/web/assets/ckeditor/src/link/linkediting.js index 71b4ccd0..d18d0a10 100644 --- a/src/web/assets/ckeditor/src/link/linkediting.js +++ b/src/web/assets/ckeditor/src/link/linkediting.js @@ -124,6 +124,8 @@ export default class CraftLinkEditing extends Plugin { writer.removeAttribute(item.model, writer.createRangeOn(node)); } } else { + // one case where selection is considered not collapsed is when you highlight a text, add a link to it, + // and then click on the "edit link" icon without closing the balloon that you see after adding a link const ranges = editor.model.schema.getValidRanges( selection.getRanges(), item.model, @@ -133,7 +135,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/606 for more info + item.type == 'bool' && item.value == true + ? '' + : extraAttributeValues[item.model], range, ); } else {