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 8
8
9
9
var $ = jQuery || djangoJQuery ;
10
10
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' ) ;
14
14
}
15
15
16
16
$ ( function ( ) {
Original file line number Diff line number Diff line change 1
1
{% 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; ">
3
3
< 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 >
4
4
</ div >
Original file line number Diff line number Diff line change 11
11
from django .utils .safestring import mark_safe
12
12
from django .utils .translation import get_language
13
13
14
+ from js_asset import JS , static
15
+
14
16
try :
15
17
# Django >=1.7
16
18
from django .forms .utils import flatatt
@@ -61,7 +63,14 @@ class Media:
61
63
js += (jquery_url , )
62
64
try :
63
65
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
+ }),
65
74
'ckeditor/ckeditor/ckeditor.js' ,
66
75
)
67
76
except AttributeError :
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ def get_source_files():
36
36
zip_safe = False ,
37
37
install_requires = [
38
38
'Django' ,
39
+ 'django-js-asset' ,
39
40
],
40
41
include_package_data = True ,
41
42
classifiers = [
You can’t perform that action at this time.
0 commit comments