We're having a problem getting Kaltura videos into a WYSIWYG field using the Media Browser.

We're using:

- Media 2.x latest dev
- Media CKEditor latest dev
- Kaltura "Auto" embed method

When I use the Media Browser and pick out a Kaltura video, it loads just fine in the Media Browser preview window, but when I get to the final step, I can't click submit in the Media Browser window due to a JS error: "Uncaught TypeError: Cannot read property 'match' of undefined" from media_wysiwyg.filter.js, line 268.

The line of JS where the error occurs looks like this: return (css.match(/\bfile-\S+/g) || []).join(' ');

If I add a simple check around that css.match part to check for the existence of "css" first, I end up with a new error from ckeditor,js: "ckeditor.js?o7nh29:342 Uncaught TypeError: a.getName is not a function". So that "css" part seems important, and it seems to be missing in my case.

Has anyone else run into this one, or does anyone else have Media Kaltura working smoothly with CKEditor?

Thanks!

Comments

hey_germano created an issue. See original summary.

hey_germano’s picture

Well, this was a little ironic, but I was able to fix this by removing the first HTML comment in the video template that says <!-- Make sure there is a wrapper so media WYSIWYG module can embed properly -->.

CKEditor wasn't liking the fact that the first thing it saw was that comment, I guess.

Might be worth turning that into a PHP comment or putting it after the div it refers to if other people hit this issue.

kenianbei’s picture

Version: 7.x-2.0-alpha1 » 7.x-2.x-dev
Assigned: Unassigned » kenianbei
Status: Active » Needs review
StatusFileSize
new11.92 KB

There are actually two issues that I found. The first is as you said, the comment is breaking insert in both media_ckeditor and media_wysiwyg. If you use the media_wysiwyg module and jQuery 1.9+, you won't have this issue. However media_ckeditor and jQuery 1.9+ still causes this error. Since I was testing with jQuery 1.9+ and media_wysiwyg I never hit this bug.

The second issue is using <1.9 jQuery will produce this error:

A call to document.write() from an asynchronously-loaded external script was ignored.

Unfortunately the kWidget js is using document.write() rather than innerHTML or appendChild(). Since this isn't something we can change, we will have to add a soft dependency for jQuery 1.9+.

So we actually need to do two things, one is move the comment up to the PHP comment. Second is add a soft dependency on jQuery update module... I'll add a note to the readme and front page.

For those who don't want to add jquery_update to their site, they can still safely use the iframe version.

kenianbei’s picture

Can you test the patch and RTBC? I'll commit after that.

kenianbei’s picture

Status: Needs review » Reviewed & tested by the community

RTBC and commiting...

  • kenianbei committed 24c382b on 7.x-2.x
    Issue #2734367 by kenianbei: Unable to insert Kaltura video into WYSIWYG
    
kenianbei’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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