|
1 |
| -from djangocms_text.editors import RTEConfig |
2 |
| - |
| 1 | +from cms.utils.urlutils import static_with_version |
3 | 2 | from django.conf import settings
|
4 | 3 | from django.templatetags.static import static
|
5 |
| - |
6 |
| -from cms.utils.urlutils import static_with_version |
7 | 4 | from django.utils.functional import lazy
|
| 5 | +from django.utils.html import format_html, html_safe |
| 6 | + |
| 7 | +from djangocms_text.editors import RTEConfig |
| 8 | + |
| 9 | + |
| 10 | +@html_safe |
| 11 | +class BasePath: |
| 12 | + def __str__(self): |
| 13 | + return format_html( |
| 14 | + '<script src="{scriptsrc}" data-ckeditor-basepath="{basepath}"></script>', |
| 15 | + scriptsrc=static("djangocms_text/js/basepath.js"), |
| 16 | + basepath=getattr( |
| 17 | + settings, |
| 18 | + "TEXT_CKEDITOR_BASE_PATH", |
| 19 | + lazy(static, str)("djangocms_text/vendor/ckeditor4/"), |
| 20 | + ), |
| 21 | + ) |
8 | 22 |
|
9 | 23 |
|
10 | 24 | ckeditor4 = RTEConfig(
|
11 | 25 | name="ckeditor4",
|
12 | 26 | config="CKEDITOR",
|
13 | 27 | js=(
|
14 | 28 | static_with_version("cms/js/dist/bundle.admin.base.min.js"),
|
15 |
| - "djangocms_text/js/basepath.js", |
| 29 | + BasePath(), |
16 | 30 | "djangocms_text/vendor/ckeditor4/ckeditor.js",
|
17 | 31 | "djangocms_text/bundles/bundle.ckeditor4.min.js",
|
18 | 32 | ),
|
19 | 33 | css={"all": ("djangocms_text/css/cms.ckeditor4.css",)},
|
20 | 34 | inline_editing=True,
|
21 | 35 | child_plugin_support=True,
|
22 |
| - additional_context=dict( |
23 |
| - CKEDITOR_BASEPATH=getattr( |
24 |
| - settings, "TEXT_CKEDITOR_BASE_PATH", lazy(static, str)("djangocms_text/vendor/ckeditor4/") |
25 |
| - ), |
26 |
| - ), |
27 | 36 | )
|
0 commit comments