I noticed with the latest -dev that when I try to embed an image into a WYSIWYG it displays (post save) as "false". I traced this back to the "Verify HTML" setting in TinyMCE and further back that the WYSIWYG isn't allowed Media's special tags. This change came about with #1451316: Clean up wysiwyg-media.js and is fixed (in my custom module) by adding $settings['extended_valid_elements'] .= ',img[src|view_mode|format|fid]'; to the TinyMCE extended valid elements through the WYSIWYG settings alter hook.

My guess is the logic in media_include_browser_js() might need to be modified, but not quite sure the approach that is being taken.

Comments

mrfelton’s picture

The mentioned hack/workaround worked for me, although my media embeds now just seem to be inserting plain old img tags, as opposed to [[media]] embeds. But I suspect thats another issue.

/**
 * Implements hook_wysiwyg_editor_settings_alter().
 *
 * Needed to fix http://drupal.org/node/1835826.
 */
function cw_media_wysiwyg_editor_settings_alter(&$settings, $context) {
  $settings['extended_valid_elements'] .= ',img[src|view_mode|format|fid]';
}
ParisLiakos’s picture

Priority: Normal » Major

Is there any way yet to reproduce this with a lean latest dev?

mrfelton’s picture

I found that in my case the problem exists with tinymce 3.5.7, but not with tinymce 3.4.9. Switching to the older version of tinymce seems to fix this, as well as the other issue I described in comment #1 (media embeds inserting plain old img tags, as opposed to [[media]] embeds)

pdcrane’s picture

I had this same problem after updating Media module to 7.x-2.0-unstable7 (from unstable6)

My fix: I discovered that the Filter Processing Order on my Text Filters needed to be adjusted so that Parsing Media tags had top priority. (admin/config/content/formats > configure)

This resolved the issue on two separate sites producing the same error as the OP, without using the proposed workaround.

Not sure if it's a fix for everyone, but it may help others searching for the same issue.

I'm not proficient with PHP, but a proposed fix would be to ensure that Media gives itself priority in Text Filter's processing (-50 row weight)

btc97’s picture

Same for me. Hack ensures the image embeds, but image properties set through TinyMCE (e.g. Alt, alignment) seem to be lost.

kingfisher64’s picture

#4 did not work for me. I'm using drupal 7.17, unstable7

I'm getting the "false" output instead of an image.

Solution

Upgrading tinymce to 3.5.8 (latest version at time of writing this) appears to fix the problem.

ParisLiakos’s picture

Priority: Major » Normal

Seems this is a tinymce issue which is fixed in latest version..maybe regression?
@mrfelton and others can you confirm 3.5.8 tinymce fixes it, so we can close this and maybe add a note in project page

Mschudders’s picture

Confirmed #6 fixes the issue

Mschudders’s picture

Confirmed #6 fixes the issue

btc97’s picture

#6 seems to have fixed it for me too.

kingfisher64’s picture

Status: Active » Fixed

Upgrading tinymce to 3.5.8 fixes the problem

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jwilson3’s picture

Same problem is happening with latest CKEditor, and can be fixed in a similar way as #1. See #1963270-5: CKeditor 4 converts Media tags to string "false".

jwilson3’s picture

Title: Problem with "Verify HTML" Filter and WYSIWYG Media Integration » TinyMCE 3.5.7 converts Media tags to string "false"

Updating title to be more relevant to this specific issue.