diff --git a/ckeditor/static/ckeditor/ckeditor-init.js b/ckeditor/static/ckeditor/ckeditor-init.js index f3bd877..c588ca9 100644 --- a/ckeditor/static/ckeditor/ckeditor-init.js +++ b/ckeditor/static/ckeditor/ckeditor-init.js @@ -29,6 +29,9 @@ $('textarea[data-type=ckeditortype]').each(function(){ if($(this).data('processed') == "0" && $(this).attr('id').indexOf('__prefix__') == -1){ $(this).data('processed',"1"); + $($(this).data('external-plugin-resources')).each(function(){ + CKEDITOR.plugins.addExternal(this[0], this[1], this[2]); + }); CKEDITOR.replace($(this).attr('id'), $(this).data('config')); } }); diff --git a/ckeditor/templates/ckeditor/widget.html b/ckeditor/templates/ckeditor/widget.html index 74e81df..6ae1308 100644 --- a/ckeditor/templates/ckeditor/widget.html +++ b/ckeditor/templates/ckeditor/widget.html @@ -1,3 +1,3 @@
- {{ value }} + {{ value }}
diff --git a/ckeditor/widgets.py b/ckeditor/widgets.py index eaa4027..9a4fbb4 100644 --- a/ckeditor/widgets.py +++ b/ckeditor/widgets.py @@ -107,10 +107,13 @@ class CKEditorWidget(forms.Textarea): if not self.config.get('language'): self.config['language'] = get_language() + # Force to text to evaluate possible lazy objects + external_plugin_resources = [[force_text(a), force_text(b), force_text(c)] for a, b, c in self.external_plugin_resources] + return mark_safe(render_to_string('ckeditor/widget.html', { 'final_attrs': flatatt(final_attrs), 'value': conditional_escape(force_text(value)), 'id': final_attrs['id'], 'config': json_encode(self.config), - 'external_plugin_resources' : self.external_plugin_resources + 'external_plugin_resources' : json_encode(external_plugin_resources) }))