Closed (fixed)
Project:
Entity Embed
Version:
8.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
5 Jun 2014 at 16:03 UTC
Updated:
9 Jul 2014 at 21:30 UTC
Jump to comment: Most recent
Add a preview of the entity once selected through the form. If possible, try to add the preview in the form also.
Comments
Comment #1
dave reidLet's cancel on adding a preview *in* the form for now and just focus on inside the WYSWIYG when the form is submitted.
Comment #2
dave reidThinking what we need:
- Probably need to render the entity in the submission of the second step of the embedding form, so that the rendered HTML can be passed into the JS for embedding into the WYSIWYG.
- Use the CKEditor widget API to ensure the user cannot edit anything inside the rendered entity HTML inside the WYSIWYG.
- Allow the user to click on the embedded node and be able to change the options of the second step of the embedding form, submit, and have the entity re-rendered in the WYSIWYG. (this might be better as a follow-up)
Comment #3
slashrsm commentedI think we need to make CKEDitor widget issue AJAX request to get rendered preview. It is how @webflo implemented it and it seems to work great. This also means that preview gets updated if someone edits tags in HTML view and switches back to WYSIWYG mode.
Comment #4
dave reidYeah, I was curious since the Image embedding plugin doesn't seem to use AJAX, so I'm not sure it supports changing the data-editor-file-uuid. It might be good to start with a hard-coded and as a follow-up convert to an AJAX request? Also, I thought that CKEditor automatically ran the text through the filter again when making changes, but maybe that's only when you change the text format.
Comment #5
yched commentedFWIW, I'm doing similar stuff for scald D7 [ ;-) ] for a client, and yeah, we do fetch the embedded entity HTML through ajax.
This module here is my hope that no other contrib module will ever need to figure this out again for its own entity type in D8 :-)
Comment #6
dave reidI'm a little curious if I click the Source button on CKEditor, and then un-click it, Drupal doesn't automatically run the edited source HTML through the filter via AJAX rather than that responsibility being on individual filters.
Comment #7
yched commentedNope. What happens when re-entering the "wysiwyg" mode is just that the widgets get re-upcasted again.
Meaning, yeah, one-by-one ajax re-fetch of the embedded entities :-/
Not sure if there's a way to make that smarter.
[edit: sorry, I'm talking from a "ckeditor.module D7" perspective. Not familiar with what happens in D8]
Comment #8
dave reidYeah, AJAX render for individual entities seems to be the way to go for now.
Comment #9
slashrsm commented@Dave Reid: we basically have example code that webflo pushed to his github. I think we can go with AJAX from the start as we probably just need to improve his code a little bit (mostly make it more general and not tied to their content types).
Comment #10
cs_shadow commentedFirst cut of the preview: https://github.com/drupal-media/entity_embed/pull/52
Comment #11
slashrsm commentedMerged.