This repository was archived by the owner on Nov 29, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 88
99 var $ = jQuery || djangoJQuery ;
1010
11- var el = $ ( '.django- ckeditor-widget ') ;
12- if ( el . length && ! window . CKEDITOR_BASEPATH ) {
13- window . CKEDITOR_BASEPATH = el [ 0 ] . getAttribute ( 'data-ckeditor-basepath' ) ;
11+ var el = document . getElementById ( ' ckeditor-init-script ') ;
12+ if ( el && ! window . CKEDITOR_BASEPATH ) {
13+ window . CKEDITOR_BASEPATH = el . getAttribute ( 'data-ckeditor-basepath' ) ;
1414 }
1515
1616 $ ( function ( ) {
Original file line number Diff line number Diff line change 11{% load static %}
2- < div class ="django-ckeditor-widget " data-field-id ="{{id}} " style ="display: inline-block; " data-ckeditor-basepath =" {% static 'ckeditor/ckeditor/' %} " >
2+ < div class ="django-ckeditor-widget " data-field-id ="{{id}} " style ="display: inline-block; ">
33 < textarea {{ final_attrs|safe }} data-processed ="0 " data-config ='{{config|safe}} ' data-external-plugin-resources ='{{external_plugin_resources|safe}} ' data-id ="{{id}} " data-type ="ckeditortype "> {{ value }}</ textarea >
44</ div >
Original file line number Diff line number Diff line change 1111from django .utils .safestring import mark_safe
1212from django .utils .translation import get_language
1313
14+ from js_asset import JS , static
15+
1416try :
1517 # Django >=1.7
1618 from django .forms .utils import flatatt
@@ -61,7 +63,14 @@ class Media:
6163 js += (jquery_url , )
6264 try :
6365 js += (
64- 'ckeditor/ckeditor-init.js' ,
66+ JS ('ckeditor/ckeditor-init.js' , {
67+ 'id' : 'ckeditor-init-script' ,
68+ 'data-ckeditor-basepath' : getattr (
69+ settings ,
70+ 'CKEDITOR_BASEPATH' ,
71+ static ('ckeditor/ckeditor/' ),
72+ ),
73+ }),
6574 'ckeditor/ckeditor/ckeditor.js' ,
6675 )
6776 except AttributeError :
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ def get_source_files():
3636 zip_safe = False ,
3737 install_requires = [
3838 'Django' ,
39+ 'django-js-asset' ,
3940 ],
4041 include_package_data = True ,
4142 classifiers = [
You can’t perform that action at this time.
0 commit comments