- Issue created by @luci_ole
- π¨πSwitzerland wengerk Lausanne
We utilize the
insertContent
function 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
insertContent
within 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.
- Status changed to Needs review
6 months ago 10:46am 6 May 2024 - π¨πSwitzerland wengerk Lausanne
It 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
schema.register("nbsp", { allowWhere: '$text', + allowAttributesOf: '$text', isInline: true, + isObject: true });
-
wengerk β
committed 98cca115 on 3.0.x
Resolve #3432756 "Splitting the links"
-
wengerk β
committed 98cca115 on 3.0.x
- Status changed to RTBC
6 months ago 10:57am 6 May 2024 -
wengerk β
committed 4a319836 on 2.x/3432756-splitting-the-links
fix issue #3432756: Splitting the links in two
-
wengerk β
committed 4a319836 on 2.x/3432756-splitting-the-links
-
wengerk β
committed cc672f0d on 8.x-2.x
fix issue #3432756: Splitting the links in two
-
wengerk β
committed cc672f0d on 8.x-2.x
- Status changed to Fixed
6 months ago 6:26am 31 May 2024 - πΊπΈUnited States ksenzee Washington state
wengerk β credited ksenzee β .
The test in #3 works fine, but when you add an tag in wysiwyg, and add an nbsp tag inside it using the "non-breaking space" button, the tag will be split !
- Status changed to Needs work
5 months ago 9:40am 4 June 2024 -
wengerk β
committed ca4c86e4 on 30x/fix-splitted-link
fix issue #3432756: Splitting the links in two
-
wengerk β
committed ca4c86e4 on 30x/fix-splitted-link
- Status changed to Needs review
5 months ago 12:05pm 10 June 2024 - π¨πSwitzerland wengerk Lausanne
I'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).
-
wengerk β
committed 52073582 on 30x/fix-splitted-link
fix issue #3432756: Splitting the links in two
-
wengerk β
committed 52073582 on 30x/fix-splitted-link
-
wengerk β
committed 74915bef on 30x/fix-splitted-link
fix issue #3432756: Splitting the links in two
-
wengerk β
committed 74915bef on 30x/fix-splitted-link
-
wengerk β
committed 6a4c3664 on 30x/fix-splitted-link
fix issue #3432756: Splitting the links in two
-
wengerk β
committed 6a4c3664 on 30x/fix-splitted-link
-
wengerk β
committed b8c85684 on 30x/fix-splitted-link
fix issue #3432756: Splitting the links in two
-
wengerk β
committed b8c85684 on 30x/fix-splitted-link
-
wengerk β
committed 9410f9ed on 30x/fix-splitted-link
fix issue #3432756: Splitting the links in two
-
wengerk β
committed 9410f9ed on 30x/fix-splitted-link
-
wengerk β
committed e85d2ef9 on 30x/fix-splitted-link
fix issue #3432756: Splitting the links in two
-
wengerk β
committed e85d2ef9 on 30x/fix-splitted-link
- π¨πSwitzerland wengerk Lausanne
For thos willing to help reviewing the code, you can integrate this patch in a Drupal project using Composer & cweagans/composer-patches.
- Update your
composer.json
file to apply the patch.
"extra": { "patches": { "drupal/nbsp": { "Splitting the links in two - 3432756": "https://git.drupalcode.org/project/nbsp/-/merge_requests/14.patch" } } }
- run the command
composer update drupal/nbsp
in order to apply the patch - Review the changes in your Drupal UI
- Update your