- Issue created by @evonasek
- Status changed to Postponed: needs info
over 1 year ago 3:27pm 20 September 2023 - 🇺🇸United States mark_fullmer Tucson
This sounds like a duplicate of ✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work . If the original poster can confirm that, let's mark this as a duplicate.
- 🇮🇳India gskharmujai
After trying out the patch that is available in https://www.drupal.org/project/linkit/issues/2966320 ✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work , the patch applied successfully for D10 but it failed to address the required functionality which involves CKEditor 5.
In D9 this was implemented using a core patch https://www.drupal.org/project/drupal/issues/2961554 ✨ Display node title by default when creating link with drupalink, allow configuration. Needs work but now with CKEditor5 as default in D10, a core patch dosent seem feasible at all.
This is not a duplicate issue. We have also tried to install the patch from https://www.drupal.org/project/linkit/issues/2966320 ✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work , but this is not working in the ckeditor5 plugin. Please keep this issue open.
- 🇺🇸United States mark_fullmer Tucson
Thanks for the additional responses. If this is not a duplicate issue, please explain how the goal or purpose of this issue is different from the goal of ✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work . If that issue is what you want but the current patch is not working, we typically don't open a new issue; we try to explain what is not working there and resolve it.
Based on a few responses, it sounds like you're saying that ✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work is not working with the CKEditor 5 plugin. My preference as a maintainer of this module is that this should be stated on that issue and work should continue there to make the patch compatible with either CKEditor 4 and CKEditor 5, rather than having one issue for CKEditor 4 and a different issue for CKEditor 5.
Thank you!
Thank you Mark. I have commented https://www.drupal.org/project/linkit/issues/2966320#comment-15245574 ✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work , so, please close this issue.
- Status changed to Closed: duplicate
about 1 year ago 3:02pm 26 September 2023 - 🇺🇸United States mark_fullmer Tucson
Thanks for the clarification. Closing this issue as a duplicate.
- 🇳🇿New Zealand klidifia
This is specifically about what the default link text is when a link is inserted via the plugin button into CKE so I don't think this is a duplicate of 2966320 ((ref comment #3 paragraph 2 (Issue 2961554)).
That issue no longer applies in D10 because the Drupal form used as an intermediary between Drupal/CKEditor no longer exists.
I am not sure the issue outlined here can be solved within Linkit now -- I don't know how this can be achieved.
- Merge request !54Issue #3388565: Use entity title as link text for new links created via CKEditor5 Link plugin → (Open) created by klidifia
- 🇳🇿New Zealand klidifia
I needed to solve this so have altered JS so when creating a new (internal) link in CKEditor5 using the Link function and locating the entity using LinkIt - the URL alias is inserted as the default link text.
There are a lot of other issues in Linkit around this or related to this:
✨ Display node title by default when creating link with drupalink, allow configuration. Needs work (Core) - This is where a solution had been made until Drupal 10 / CKEditor5
✨ Show URL alias after autocomplete selection instead of internal route (e.g., /node/123) Needs work
✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work
#3014297: Use target name as anchor text →
✨ Insert node title instead of # when no link text is selected Closed: works as designed
✨ Allow customization of default text when text not selected Closed: outdated - 🇹🇭Thailand Nick Hope
@klidifia Thanks for the heads-up on the related issue → .
I made a patch out of #10 and patched 7.0.0-alpha1 with it.
In my testing (linking to taxonomy terms only, which is my use case), if a link to a taxonomy term is inserted in an article without first selecting text, the small link window does not dismiss when the green arrow is clicked. I can dismiss that window by clicking outside it, in the body of the article. Then the link is just shown as a vertical bar (like a pipe symbol). When I save the article, the taxonomy term name is shown, but followed by the term route. e.g. Thailand/taxonomy/term/683, where "Thailand" is the term name.
- 🇳🇿New Zealand klidifia
@nick-hope thanks for trying it. I can't see what might be happening, I imagine it is producing some sort of JS error in console when not closing the Link window. I tried the same on a Fresh D10 install. Configured the default Linkit matcher to include taxonomy terms, made a term (Thailand) and tested on a new page in a few separate places. (Type 'Thai', select via Linkit, enters Link URL as /taxonomy/term/1, click green tick, entered as Thailand.)
<p> <a href="/taxonomy/term/1" data-entity-type="taxonomy_term" data-entity-uuid="c2415acd-08e0-494d-b51d-09acc1728f0d" data-entity-substitution="canonical" data-entity-title="Thailand">Thailand</a> </p>
- 🇹🇭Thailand Nick Hope
@klidifia Thanks for testing it.
I'm testing with Drupal 10.2.6, Linkit 7.0.0-alpha1 with a patch downloaded from your last MR. I've tried on an old Drupal D10 project and a near-vanilla D10 project. Tried articles, basic pages, basic HTML, full HTML, default Linkit profile, new "Taxonomy Terms" Linkit profile.
I'm finding that the link window will close correctly for the first link I create in an article, but today I'm getting the route before the term name in the anchor text (reverse of yesterday), like this:
<a href="/taxonomy/term/9" data-entity-type="taxonomy_term" data-entity-uuid="2c20c5cb-dee2-4af4-9408-2394309a3c19" data-entity-substitution="canonical" data-entity-title="Thailand">/taxonomy/term/9Thailand</a>
When I try to create a 2nd link in the same article, I get this console error in Chrome (I'm afraid I'm not much use at interpreting it):
ckeditor5-dll.js?v=40.2.0:5 Uncaught TypeError: Cannot read properties of undefined (reading 'attributes') at Ar.getChanges (ckeditor5-dll.js?v=40.2.0:5:376656) at html-support.js?v=40.2.0:5:44080 at $r._callPostFixers (ckeditor5-dll.js?v=40.2.0:5:390254) at $r._handleChangeBlock (ckeditor5-dll.js?v=40.2.0:5:389512) at Cn._runPendingChanges (ckeditor5-dll.js?v=40.2.0:5:424836) at Cn.change (ckeditor5-dll.js?v=40.2.0:5:421831) at r.on.priority (editorAdvancedLink.js?v=10.2.6:1:7035) at oe.fire (ckeditor5-dll.js?v=40.2.0:5:604093) at <computed> [as execute] (ckeditor5-dll.js?v=40.2.0:5:607777) at f.execute (ckeditor5-dll.js?v=40.2.0:5:112967) rethrowUnexpectedError @ ckeditor5-dll.js?v=40.2.0:5 change @ ckeditor5-dll.js?v=40.2.0:5 r.on.priority @ editorAdvancedLink.js?v=10.2.6:1 fire @ ckeditor5-dll.js?v=40.2.0:5 <computed> @ ckeditor5-dll.js?v=40.2.0:5 execute @ ckeditor5-dll.js?v=40.2.0:5 execute @ ckeditor5-dll.js?v=40.2.0:5 (anonymous) @ link.js?v=40.2.0:5 fire @ ckeditor5-dll.js?v=40.2.0:5 e.listenTo.useCapture @ ckeditor5-dll.js?v=40.2.0:5 fire @ ckeditor5-dll.js?v=40.2.0:5 t @ ckeditor5-dll.js?v=40.2.0:5
I could do a screen recording with a completely fresh D10 project if that would help, so we can see if/where our steps differ.
- Status changed to Needs work
7 months ago 10:07pm 22 May 2024 - 🇳🇿New Zealand ericgsmith
Nice work @klidifia!
I am reopening this issue since its hidden being closed when there is work continuing on it.
I agree that it sounds like it is not exactly a duplicate of ✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work although that issue would be useful alongside this one - but that is specifically talking about the UI shown after making a selection from the autocomplete - where as this is about the default text content of the link.
I have this a test on a clean install and it looks good to me - updated issue summary with a gif recording of it.
I think the existing
LinkitDialogCKEditor5Test
should be updated to show that the default text is the entity label. Setting to needs work for this change.I also did not get the error reported in #11 - but I see in the js log it mentions
editorAdvancedLink
- I have not tested in combination with this module but could that be doing anything to interfere with the attributes? - 🇹🇭Thailand Nick Hope
Good spot @ericgsmith. It does indeed seem to be an incompatibility with the Editor Advanced Link module → . If I uninstall that, then this patch works correctly. Apologies for that oversight.
Editor Advanced Link is quite a widely adopted module (109k sites), so this incompatibility should probably be addressed before (if) this feature is added to Linkit. Not sure which side it would need addressing from.
There are also important views and discussion on the related issues ( example ✨ Show entity title after autocomplete selection instead of internal route (e.g., /node/123) Needs work ) that should be considered.
- 🇳🇿New Zealand klidifia
Thanks both -- Yeah I can replicate that with installing Editor Advanced Module.
I note the code block on both modules is basically the same around the
_addExtraAttributeOnLinkCommandExecute
Both have same priority high, if I change editoradvancedlink to highest, then it works OK. I'm not sure yet of the best way to make them play nice together and if there are other issues with both modules in play.
- First commit to issue fork.
jessmm → changed the visibility of the branch linkit-3388565-3388565-7 to hidden.
- 🇳🇿New Zealand ericgsmith
Rebased MR after conflicts introduced when 🐛 No longer a way to post a link as-is if there is 1 pattern match Active was comitted.