GHS: "Learn from Link Plugin's" _enableClickingAfterLink β Add Cleanup Behavior For Custom Attributes bound to anchor elements #13594
Labels
resolution:expired
This issue was closed due to lack of feedback.
type:improvement
This issue reports a possible enhancement of an existing feature.
π Provide a description of the improvement
The Suggestion
Extract code from
linkediting.ts
regarding_enableClickingAfterLink
and re-use cleanup behavior when anchor tags are handled in GHS plugin. Thus, make it possible to also remove any attributes defined by GHS that are bound to anchor tags.The bigger picture: As sketched in #9730, we hook into the link feature to add more behaviors to it. Like our own management of the
target
attribute (CKEditor's default solution is not enough for us). Currently, we have to copy, paste and adapt the code of_enableClickingAfterLink
, while it would be much nicer to have an "approved" version by CKEditor-Team how to deal with these cleanups after repositioning the cursor.The Issue
When you configure the GHS for anchor
<a>
tag to hold additional attributes, these attributes will not inherit the cleanup-logic from_enableClickingAfterLink
:ckeditor5/packages/ckeditor5-link/src/linkediting.ts
Lines 415 to 460 in 2139d5a
As a result, when clicking before or after a link, all other attributes will remain and the anchor element will be continued β while the link plugin won't detect it as link anymore, as it just checks for the
linkHref
attribute.For a custom attribute
data-xlink-type
we have to add due to our data, this will result in editing view like this when placing the cursor in front of the link (can be observed in inspector very nicely):To push it to the limits, disable link plugin and position the cursor behind the link. You will notice, when typing, that the anchor is expanded. While this is a nice advertisement for the link feature to enable it, it seems to me, that this cleanup logic should be made available also to GHS.
π Other details
If you'd like to see this improvement implemented, add a π reaction to this post.
The text was updated successfully, but these errors were encountered: