Skip to content

Resolve #3270688: Bold and italic formatting are not applied in summary

This PR comprehends a fix for the issue #3270688: Bold and italic formatting are not applied in summary.

After some investigation and attempts, I found out that the blur event in the function _addEventListeners() in the file js/ckeditor5_plugins/detail/src/detailediting.js is replacing the whole text in the summary with it own on each blur event, which happens when we click on any format buttons in CKEditor (e.g. Italic). This is causing the removal of the text selection, meaning the format won't be applied because there is no text selected anymore. This is caused by a functionality to remove (technically, it's replacing it with an empty string) all zero-width spaces from the summary, which happens on each blur event, no matter if there's any occurrence of that character in the summary or not.

I added an if statement to make sure the replacement only happens if a ZWSP is found in the summary. This will cause the formatting not being added in the very first attempt, when the ZWSP is removed, but it will work after that (unless a new ZWSP is added). I acknowledge this will cause this glitch when a ZWSP is added, but that seems to be a very edge case. This solution can definitely be improved, but I believe, for now, this is a quite decent fix to resolve this issue for the vast majority of the situations.

Please let me know if you have any questions. Thank you.

Edited by Mauricio Silveira

Merge request reports

Loading