From 7b67aba2318aae0f9934a9ce3a548f25f57cf03a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Mali=C5=84ski?= Date: Sun, 7 Dec 2014 21:03:50 +0100 Subject: [PATCH] Check for jQuery presence correctly. --- ckeditor/static/ckeditor/ckeditor-init.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ckeditor/static/ckeditor/ckeditor-init.js b/ckeditor/static/ckeditor/ckeditor-init.js index 7be607d..f3bd877 100644 --- a/ckeditor/static/ckeditor/ckeditor-init.js +++ b/ckeditor/static/ckeditor/ckeditor-init.js @@ -1,5 +1,12 @@ -;(function() { - var $ = $ || django.jQuery; +(function() { + var djangoJQuery; + if (typeof jQuery == 'undefined' && typeof django == 'undefined') { + console.error('ERROR django-ckeditor missing jQuery. Set CKEDITOR_JQUERY_URL or provide jQuery in the template.'); + } else if (typeof django != 'undefined') { + djangoJQuery = django.jQuery; + } + + var $ = jQuery || djangoJQuery; $(function() { initialiseCKEditor(); initialiseCKEditorInInlinedForms(); @@ -25,6 +32,6 @@ CKEDITOR.replace($(this).attr('id'), $(this).data('config')); } }); - }; + } }); }());