Active
Project:
Entity Embed
Version:
8.x-1.x-dev
Component:
CKEditor integration
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 Jun 2019 at 09:43 UTC
Updated:
26 Nov 2024 at 19:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
wim leersFunny, none of the 83 followers in #2511404: Image entities/fields embedded using Entity Embed cannot be linked in CKEditor ever thought of that! Oh, no, I'm wrong — @wrd thought of that in #2511404-40: Image entities/fields embedded using Entity Embed cannot be linked in CKEditor apparently. Crediting him too. He wrote:
I think we can detect the presence of links in an embedded entity's representation, and if so, disallow linking. Of course, an entity could change over time and could gain links at a later time.
In that sense, @wrd's proposal to make it configurable per entity type probably makes more sense?
Comment #4
wim leersUntagging because I think this only ever applies to non-Media entities.
Comment #5
marcoscanoNo big deal, but I don't think so. In our use case for example, we have a "Document" media type that, when rendered, displays:
- an icon,
- the file size
- a taxonomy term name that was added to the document
- a link to download the file.
Also, I can think of remote media items such as tweets or instagram posts, that would also include links in their internal markup.
I like a lot the idea of avoiding a run-time smart detection and just configuring somewhere which media types should be "linkable". We could default to types that use the image source, but allow other types to opt-in (while also allowing some image-based types to opt-out)
Thanks!
Comment #6
wim leersYou're absolutely right. Sorry about that.
Comment #7
wim leersDid more testing yesterday. Turns out a linked embedded entity still has correctly working links inside the embedded entity. So actually, the originally reported problem is a non-problem.
Also: it's possible that an entity containing links may want to have the links still rendered when embedded but wants them to be made non-interactive.
This is a very hard problem, which really depends on the scenario. It's not at all clear what the appropriate course of action is.
Comment #8
wim leersThis came up again, but now in Drupal core's
DrupalMediaCKEditor plugin: #3075527: FilterAutoP breaks links around the <drupal-media> tag.Comment #9
ckaotikI see a problem with an auto-detect solution. Yes, anchor tags within anchor tags are a horrible mess and invalid HTML. However, we sometimes have to work with layouts doing just this. Here's a sample scenario with a required license/copyright link on some media:
Usually, such code is accompanied by some
z-indexCSS rules.Yes, this can be solved better using an "empty"
<a href="..."></a>Tag (e.g. https://bdwm.be/html5-alternative-nested-anchor-tags), but rewriting all templates is oftentimes not feasible :(A general setting on the embed button config, maybe with an alter-hook for special cases, should work nicely. But an automatic detection gives me headaches.
Comment #10
geek-merlinWith HTMLDom it's quite straightforward to eliminate all a tags. We can expose this as a twig markup filter to use in the default template. And we can expose an alternative filter that uses the object hack (google it) to wrap a tags in object tags so links inside links are functional, and people can use it in their custom templates.
Comment #11
kasey_mk commentedJust updated to 1.5 on Drupal 10.1.6 and I came here hoping to find an option to turn off linking on embedded entities.
We use entity_embed exclusively for Paragraphs, which all handle links their own way. I need a way to prevent users from trying to add links around all that. Even if there was a check-and-fix for a tags within a tags before rendering, I don't want a confusing UI offering options that won't work and obscuring the options that will.
Comment #12
kasey_mk commentedHere's a super-simple patch that I think just removes the link button from the UI without touching anything else:
In js/build/drupalentity.js,
t("Entity Embed toolbar"),items:["entityEmbedEdit","entityEmbedLink","editEmbeddedEntity"]becomest("Entity Embed toolbar"),items:["entityEmbedEdit","editEmbeddedEntity"]As discussed above, I'd love to see some options built in - to turn the linking on or off entirely, or as suggested, per entity - but this will let me move ahead with my use case.
Thanks to all who work on this! I can see that adding links was a huge effort, and just because I need it to not be there doesn't mean I don't appreciate all the time everyone put on it!
Comment #13
loze commentedI think all the options available in ckeditor5 (edit, link, align, caption, etc.) should all be configurable on the media bundle, or view mode.
Comment #14
tichris59 commentedAs Kasey_MK , we use entity embed with entity that can't contain be linked, this button must be hide in my case, it would be great to choose which entity can use it, case by cas (per example media image like it but media map in my case not).
I put here a patch that merges #12 and another bug https://www.drupal.org/project/entity_embed/issues/3416277 (#2).
Thanks for your patch Kasey_MK
Comment #15
javi-er commentedThe problem with @kasey_mx patch is that it replaces the build script entirely, so any new releases of this module will have the build code reverted to the specific version of this patch without you noticing it. Ideally a config option should be added for allowing or removing linking as asked above.