When using Panels, inserting media in a WYSIWYG text area doesn't work.

The following scenario requires the Media button to be enabled in your WYSIWYG config (I tested using CKEditor).

* Add a custom panel pane to a panel page.
* Click the 'Add media' button.
* Upload a file or find one in the library.
* Click submit.

Clicking submit should take you the file style config in the modal, but it doesn't in this case.

Not sure if this is caused by Media's WYSIWYG JS, or by Panels. I found a JS error in the console (see below), relating to CKEditor, so logging it here.

TypeError: defaults.src.replace is not a function (154 out of range 6)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lythimus’s picture

I'm having the same issue. This is a hack, but it works.

agoradesign’s picture

I'm not using Panels, but also had the problem. Interestingly, it appeared suddenly, without doing any updates, etc before. The only thing I had changed, was the file_entity.tpl.php and a theming function from Media Colorbox - both should normally have nothing to do with the media browser... But these were the only File/Media related changes I did in the last couple of weeks...

However, your patch helped me a lot! I totally agree with you, that this is some kind of a hacky solution, but it doesn't harm + the maintainer already is stating before the next line, that the following line is a hacky solution too:

// @todo: remove this awful hack :(

Therefore I'd like to see this commited, until there's a better solution for finding the defaults.src in general. Any fears against this bugfix from anyone?

brunodbo’s picture

Patch in #1 doesn't work for me. When I submit the media upload form, I get the message "The file was uploaded" in an otherwise empty modal.

Console shows the following:

Uncaught TypeError: Object /media/-media_id-/format-form?render=media-popup,/media/-media_id-/format-form?render=media-popup has no method 'replace' (program):155
Drupal.media.popups.mediaStyleSelector (program):155
InsertMedia.onSelect (program):163
s jquery.js:36
dialogOptions.buttons.(anonymous function) (program):84
Drupal.media.popups.mediaBrowser.mediaBrowserOnLoad (program):108
c.event.handle jquery.js:64
h.handle.o jquery.js:57
ParisLiakos’s picture

brunodbo’s picture

Status: Active » Closed (duplicate)

Same issue and errors yep. Marking as duplicate of #1630288.

brunodbo’s picture

Issue summary: View changes

Fixing issue summary.