Closed (fixed)
Project:
Entity Embed
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
16 May 2014 at 15:51 UTC
Updated:
3 Jun 2014 at 17:40 UTC
Jump to comment: Most recent
Imagine this HTML:
<p>This is at the beginning.</p>
<p data-entity-type="node" data-entity-uuid="870e91f5-9404-4327-a543-67d9fee147fc" data-view-mode="teaser">This is where embedded entity will live.</p>
<p>This should stay at the end.</p>
Text filter currently appends embedded entity at the end of existing content:
<p data-entity-type="node" data-entity-uuid="870e91f5-9404-4327-a543-67d9fee147fc" data-view-mode="teaser">This is where embedded entity will live.<article>//embedded entity//</article></p>
My question is do we want embedded entity to replace existing content? And if answer is yes, wether do we want to replace only the existing content inside parent DOM node or entire node (<p> in this case).
Comments
Comment #1
cs_shadow commentedComment #2
cs_shadow commentedIMO the inner content should be replaced by the embed. But we must retain the parent DOM element, because client side styles may depend on that element. Its also the standard that's followed elsewhere.
Comment #3
slashrsm commentedI agree with this solution. It seems the most logic one.
Comment #4
cs_shadow commentedCurrently we used to append to the embeds to the existing content. As mentioned in #2: we should replace the content. This is done in the this PR: https://github.com/drupal-media/entity_embed/pull/7/
Comment #5
cs_shadow commentedComment #6
dave reidI'm curious why this would happen in the first place and why we'd need to care, especially if we're always going to be rendering embeds using a single closed div? Should we maybe split this to a separate PR?
Comment #7
slashrsm commentedWhy would we assume single closed div for all cases? Even if that is default behaviour I see something else as perfectly valid also.
+1 for splitting PRs. Let's always have separate PR for each issue.
Comment #8
cs_shadow commentedThis may happen if someone is trying to manually embed (writing HTML instead of using UI) an entity.
One can also fill in some placeholder text that gets displayed if the embed fails. It never hurts to make sure from our side that all the existing content is cleared before embedding.
Comment #9
cs_shadow commentedSeparate PR for this issue: https://github.com/drupal-media/entity_embed/pull/8
This PR will work if previous PR is merged.
Comment #10
slashrsm commentedLooks good to me.
Note that PR shows I merged it but I didn't. I merged #2269139: Entity ID currently overrides entity UUID - it should be vice-versa and it showed this one as merged also. Meh Github! :)
Comment #11
cs_shadow commentedNow I realize that the branch from which I created PR #8 was actually one commit behind the one from which I created PR #7. And hence since all the commits of #8 were already in #7, it was closed. To fix this issue, I've created a new PR: https://github.com/drupal-media/entity_embed/pull/9
After this one is merged, it should be fine.
Comment #12
slashrsm commentedRe-opening for tests.
Comment #13
cs_shadow commentedComment #14
dave reidI merged https://github.com/drupal-media/entity_embed/pull/9 just because it's blocking several other issues and we seem to be stalled on tests.
Comment #15
slashrsm commentedOK. Let's close this. @cs_shadow, please open a test follow-up and assign it to yourself for later reference.