Reviewed & tested by the community
Project:
CKEditor Non-breaking space Plugin ( )
Version:
3.0.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Mar 2024 at 14:37 UTC
Updated:
14 Feb 2025 at 07:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wengerkWe utilize the
insertContentfunction to inject HTML into CKEditor 5, which appears to be the recommended method for injecting model fragments (such as<nbsp> </nbsp>).Referencing our implementation in the nbspCommand.js file.
However, we've encountered an issue where using
insertContentwithin a link results in the link being split, as noted by @luci_ole.Despite searching the CKEditor 5 documentation and the Github Issue Queue, we haven't found a solution to prevent this behavior.
Any assistance in resolving this issue would be greatly appreciated. If any maintainers or individuals are aware of modules or implementations that successfully insert HTML within a link in CKEditor 5, we would be eager to examine their approach.
Comment #4
wengerkComment #5
wengerkIt was a schema issue as pointed by ksenzee on Slack https://drupal.slack.com/archives/C01GWN3QYJD/p1714662493560729?thread_t...
To solve the problem, I just changed the schema
Comment #7
wengerkMerged on dev branch 3.0.x
For people willing to use this fix before release of 3.0.2, please use the patch on Gitlab.
Comment #10
wengerkComment #12
wengerkGive credit to ksenzee for helping me pointing the issue on Slack
https://drupal.slack.com/archives/C01GWN3QYJD/p1714637176482069
Comment #13
drunir commentedThe test in #3 works fine, but when you add an "a" tag in wysiwyg, and add an "nbsp" tag inside it using the "non-breaking space" button, the "a" tag will be split !

Comment #14
wengerkComment #16
wengerkI've made a new batch of fix about how the command inject the nbsp tag. Should now propertly keep all AttributeElement and not break them (eg. breaking links).
Comment #23
wengerkFor thos willing to help reviewing the code, you can integrate this patch in a Drupal project using Composer & cweagans/composer-patches.
composer.jsonfile to apply the patch.composer update drupal/nbspin order to apply the patchComment #24
drunir commentedI tested the new patch, it works well for me, thanks @wengerk
Comment #25
wengerkComment #27
wengerkThanks for testing it ! merged in 3.0.x (dev) will made a new release asap