am I doing something wrong or is the following not (yet) implemented:

I can insert a node in my WYSIWYG Editor but I only see the tag [[nid:472]] not the rendered embedded node. When I select "preview" I do see the embedded node, but the template is not used. Finally when I save the node and watch it, everything is fine and the embedded node gets rendered using my template...

Comments

aleksandar.jakovljevic’s picture

Same here. I'm using the drupal 7 version of the plugin.
Ideal would be if the tag could be visible in source, but the rendered embedded node to be shown in the WYSIWYG (not to be editable directly, though).

Is there a way to achieve this?

aethem’s picture

Hi,

I'm also trying to use node embedding in Drupal 7. Where did you find the Drupal 7 version of this module?

Any luck getting it to work well?

Cheers,
A

komlenic’s picture

The D7 version of Node Embed can be found here http://drupal.org/node/1149106 (not yet an official release). Now an official release, see below. I've been using it without issue on D7.

See also: http://drupal.org/node/1431518

komlenic’s picture

Note that Node Embed now has an official D7 version.

To answer #1, I do not know of any way to make portions of CKEditor in WYSIWYG mode un-editable, while still allowing other portions to be editable. Clearly we'd need to make included node parts not editable somehow for this to be integrated intuitively.

Additionally (and related), less-savvy users have been known to delete the tags ([[nid:472]]), or otherwise mangle them, then save their changes. The only solution I can conceive is to only allow node embed on an input filter like "full html" which you then only allow certain trusted roles to edit. Then of course, lesser roles can no longer edit these nodes at all.

Ideally, a solution here would:

  • show [[nid:472]] tags in source view
  • show a rendered version of the embedded node in WYSIWYG view
  • not permit editing of the embedded nodes in WYSIWYG view
  • make it clear where the embedded content starts and stops as well as why it can't be edited directly (possibly with a link to where it actually lives, where it can be edited)
lance.gliser’s picture

I'm not certain you would need to avoid users editing the embedded node. I believe point #4 "make it clear where the embedded content starts and stops as well as why it can't be edited directly" would be enough.

As to how we could possibly render it in the WYSIWYG view... I think #4 covers that need as well.

I can imagine inserting something like:

<!--node-embed-wysiwyg-preview-[nid:##]-->
<div class="node-embed-wysiwyg-preview">
<div class="node-embed-label">[Embedded Node: ###]</div>
<div class="node-embed-content"> ... </div>
<div class="node-embed-label">[Embedded Node: ###]</div>
</div>
<!--/node-embed-wysiwyg-preview-[nid:##]-->

With that html structure, we should be able to put something like dashed lines around the entire preview, and also provide a regex to change the above code back into the embed syntax on node save, since we have a clear start, stop, and id available in the 'likely' uneditable html comments.

Edit

Sadly, I realized one thing potentially tricky about the above.
Our embed tags can contain extra arguments. We'd have to expand the html comment to include the full embed syntax, not just the node id.

amaisano’s picture

Issue summary: View changes

If the Media module can do it, then so can we :)

amaisano’s picture

Version: 6.x-1.3 » 7.x-1.x-dev
Category: Support request » Feature request
michaelfavia’s picture

StatusFileSize
new22.9 KB

Actually it looks like media module is attempting to do it on our behalf! :)
Code

TO recap their approach it looks like they are parsing through the field and creating a "tagmap" out of anything matching [[ THINGS HERE ]]. Unfortunately t looks like our node embed elements are getting swept up in the process. I can only imagine that others are as well. THe only part it doesnt seem to be doing is making the actual replacement in wysiwyg-media.js.

Obviously we don't want the media module doing this on our behalf but perhaps we can ape the functionality they've implemented. Its not an approach i might have thought of thats for sure. I would have used some JS callbacks or something.

Preferences on approach? We have a client that needs this and I'm willing to implement next week if there is any feedback.

amaisano’s picture

The Media filter/replacement technique seems like a good place to start experimenting. It has all the right stuff - showing [[TAG]] while in source or full html mode, and rendering it in WYSIWYG / Preview mode.

[[Encouragement]]

smd_ksu’s picture

Just want to say that I would not want this to be the only way it is handled. Optional is fine but I want the tag, not to see it rendered in the WYSIWYG.

mrharolda’s picture

Status: Active » Closed (won't fix)

Unless someone supplies a patch for this, I won't be adding this as it seems too much work/hassle/impact.

Please re-open if you plan to work on this! It is a fancy feature, after all ;)