I just updated a site to use unstable7, and it seems a behavior has changed.

Previously, AFAIK, the WYSIWYG media button would insert media assets using the media filter syntax. However, unstable7 seems to be inserting the generated HTML directly. Is this the expected behavior?

Comments

ParisLiakos’s picture

check this issue if this happens on images: #1835826: TinyMCE 3.5.7 converts Media tags to string "false"

Josh Benner’s picture

#1835826: TinyMCE 3.5.7 converts Media tags to string "false" seems specific to TinyMCE's cleanup.

I've dug into the code to understand what's going on with this one. You will see this behavior if the view mode you embed outputs a non-image as its outer element. In my case, I was outputting my image wrapped in a link tag. This was causing the detach to fail to match, so the macro wasn't substituted for the HTML, which resulted in the HTML being saved to the field rather than the macro.

In my case, I'm planning to just output the img without the link (and add the link via JS later), but this may be an issue that crops up repeatedly.

rst’s picture

I see the same thing with unstable7 when inserting a link to a Document file.

The file display setting for Document is set to "Generic File" in the file type settings.
I am using wysiwyg with CKEditor 3.6.5.

The HTML for the link is placed in the node body instead of the [[media]] tags. Is this intentional?

twod’s picture

This happened for me when no formatter was enabled on admin/structure/file-types/manage/image/file-display.
I have no idea why none of them are enabled by default, or where it gets the markup from when none are.

The reason it won't insert a macro tag is that the markup generated when no formatter is enabled doesn't contain the media-element class, so the plugin for Wysiwyg can't recognize the tag.

ParisLiakos’s picture

Status: Active » Closed (works as designed)

it inserts markup with a data-file attribute right? check #1942688: Documents embedded in WYSIWYG get converted to HTML by the editor

ParisLiakos’s picture

Status: Closed (works as designed) » Active

ah..it has no media-element class..then thats another issue sorry

cbeier’s picture

Category: support » bug

I have a similar problem. For me, the integration over the CKEditor module is probably the problem.

  • Drupal 7.22
  • Media 7.x-2.x-dev (the problem exists also in 7.x-2.0-unstable7)
  • CKEditor Modul with CKEditor 4.1 (or CKEditor 3.6.6.1 [I've tried both])

If I insert a image, I get the following result:

<p><img alt="" class="media-image attr__typeof__foaf:Image img__fid__5 img__view_mode__teaser attr__format__teaser attr__title__" height="135" src="http://[domain]/sites/default/files/styles/wis_teaser/public/wissenstandsorte_eingang.png?itok=cQMFiZe9" title="" typeof="foaf:Image" width="135" /></p>

If I use the WYSIWYG module with CKEditor 3.6.6.1, I get the (expected) result:
<p>[[{"fid":"1","view_mode":"teaser","type":"media","attributes":{"height":88,"width":220,"class":"media-element file-teaser"}}]]</p>

But with the WYSIWYG module I have some problems with Panels. So the use of the WYSIWYG module is not a solution for me. :)

gmclelland’s picture

I had similar problems, see #2028255: ckeditor styles break media module markup. In my case it is changing media's markup to the markup posted in #7 when I apply a style from the ckeditor style dropdown after inserting the media item. Selecting the style, ex. media-right would cause the media markup to become garbled.

Note: I'm using the wysiwyg module with ckeditor library.

drupal_was_my_past’s picture

Status: Active » Closed (won't fix)

I believe this is a WYSIWYG module bug. See #1956778-6: Ckeditor 4.1 ACF for a temporary solution. #1956778: Ckeditor 4.1 ACF is seeking a more permanent solution.