1. evildmp
  2. semanticeditor
Issue #1 invalid

Error in javascript with new django-cms 2.3 release, django1.4, jQuery namespacing issues

Zak Patterson
created an issue

When loading the semantic editor in the django-cms front-end editor, there is a javascript error in the editor_widget template, on this line:

{{{ var qs = jQuery.query.load(window.parent.location.search);

Uncaught TypeError: Cannot call method 'load' of undefined }}}

Examining this, at this point in execution jQuery is defined, but jQuery.load is undefined. Some other code loaded by django-cms is obliterating jQuery.

This is probably coming from line 8 of cms/js/plugins/cms.setup.js:

{{{ var jQuery = (django) ? django.jQuery : window.jQuery || undefined; }}}

Fixing this error using closures leads to exactly the same thing in static/semanticeditor/javascript/wymeditor/plugins/semantic/wymeditor.semantic.js,

which can be fixed in the same way.

I can upload a diff, but it is fixed very well just by wrapping the $(document).ready call in editor_widget with:

{{{ (function(jQuery){

})(jQuery); }}}

And wrapping all the code in wymeditor.semantic.js with the same thing.

using semanticeditor: 6a344716ddd2 tip

Django 1.4

django-cms 2.3 (RC) 6ee3f435886692a08b9ec18e93d2595154fe89d5

Comments (1)

  1. Log in to comment