Testing with Media_dev-7.x-2.x-dev distribution. IE 10 on Windows 7.

Create article. Insert image in editor. Save. Use devel to view body[und][0][value]. Image is saved using img tag instead of media macro.

• <p><img alt="" class="media-element file-default" data-file_info="%7B%22fid%22:%225%22,%22view_mode%22:%22default%22,%22fields%22:%7B%22format%22:%22default%22,%22field_file_image_alt_text%5Bund%5D%5B0%5D%5Bvalue%5D%22:%22%22,%22field_file_image_title_text%5Bund%5D%5B0%5D%5Bvalue%5D%22:%22%22,%22media_description%5Bund%5D%5B0%5D%5Bvalue%5D%22:%22%22,%22field_tags%5Bund%5D%22:%22%22%7D,%22type%22:%22media%22%7D" src="https://my.host.name/media_dev-7.x-2.x-dev-2/sites/default/files/Tulip.jpg" typeof="foaf:Image" /><!--MEDIA-WRAPPER-END-1--></p>

So it looks like the MEDIA-WRAPPER-START comment is removed upon insert into the WYSIWYG.

http://dev.ckeditor.com/ticket/6709
This ticket on the CKEditor Community website says “In IE, when setting innerHTML, any starting

comments are removed.” The ticket is from 3 years ago, but perhaps it still holds true.

Suggested fix is to prefix with a dummy tag ""

in wysiwyg-media.js, in insert: function

from

var markup = Drupal.media.filter.getWysiwygHTML(element);

to

var markup = "<foo:bar />" +  Drupal.media.filter.getWysiwygHTML(element);

With this change, inserting an image saves the media macro.

• <p><foo:bar>[[{"fid":"5","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"","field_file_image_title_text[und][0][value]":"","media_description[und][0][value]":"","field_tags[und]":""},"type":"media","attributes":{}}]]</foo:bar></p>

Comments

DamienMcKenna’s picture

kaidjohnson’s picture

#2067063: Wysiwyg integration is broken -- Solution track is moving away from the wrapper comments for this reason and others, including a problem with moving media around through drag and drop. This issue should be moot once that issue is resolved.

bneil’s picture

Component: Code » WYSIWYG integration
ParisLiakos’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)
Related issues: +#2067063: Wysiwyg integration is broken