diff --git a/djangocms_text/cms_plugins.py b/djangocms_text/cms_plugins.py
index 7ae5cb31..829321e1 100644
--- a/djangocms_text/cms_plugins.py
+++ b/djangocms_text/cms_plugins.py
@@ -2,7 +2,6 @@
import operator
import re
-from cms.utils import get_language_from_request
from django.apps import apps
from django.contrib.admin.utils import unquote
from django.core import signing
@@ -10,11 +9,7 @@
from django.db import transaction
from django.forms.fields import CharField
from django.http import (
- Http404,
- HttpResponse,
- HttpResponseBadRequest,
- HttpResponseForbidden,
- HttpResponseRedirect, JsonResponse,
+ Http404, HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseRedirect, JsonResponse,
)
from django.shortcuts import get_object_or_404
from django.template import RequestContext
@@ -26,12 +21,16 @@
from django.views.decorators.http import require_POST
from cms.models import CMSPlugin, Page
+from cms.utils import get_language_from_request
+
+from .settings import TEXT_CHILDREN_ENABLED
try:
from cms.models import PageContent
except ImportError:
from cms.models import Title as PageContent
+
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.utils.placeholder import get_placeholder_conf
@@ -42,15 +41,8 @@
from .html import render_dynamic_attributes
from .models import Text
from .utils import (
- OBJ_ADMIN_WITH_CONTENT_RE_PATTERN,
- _plugin_tags_to_html,
- cms_placeholder_add_plugin,
- plugin_tags_to_admin_html,
- plugin_tags_to_id_list,
- plugin_tags_to_user_html,
- plugin_to_tag,
- random_comment_exempt,
- replace_plugin_tags,
+ OBJ_ADMIN_WITH_CONTENT_RE_PATTERN, _plugin_tags_to_html, cms_placeholder_add_plugin, plugin_tags_to_admin_html,
+ plugin_tags_to_id_list, plugin_tags_to_user_html, plugin_to_tag, random_comment_exempt, replace_plugin_tags,
)
from .widgets import TextEditorWidget, rte_config
@@ -572,7 +564,7 @@ def get_child_plugin_candidates(cls, slot, page):
page=page,
)
# Filter out plugins that are not in the whitelist if given
- if settings.TEXT_CHILDREN_WHITELIST:
+ if settings.TEXT_CHILDREN_WHITELIST is not None:
text_enabled_plugins = [
plugin
for plugin in text_enabled_plugins
@@ -597,7 +589,7 @@ def render_plugin_icon(self, plugin):
def get_plugins(self, obj=None):
plugin = getattr(self, "cms_plugin_instance", None) or obj
- if not plugin:
+ if not plugin or not TEXT_CHILDREN_ENABLED:
return []
get_plugin = plugin_pool.get_plugin
child_plugin_types = self.get_child_classes(
diff --git a/djangocms_text/cms_toolbars.py b/djangocms_text/cms_toolbars.py
index 54ebee46..1a2c927c 100644
--- a/djangocms_text/cms_toolbars.py
+++ b/djangocms_text/cms_toolbars.py
@@ -21,7 +21,7 @@ class IconButton(Button):
class InlineEditingToolbar(CMSToolbar):
@property
def media(self):
- if self.toolbar.edit_mode_active and self.inline_editing:
+ if self.toolbar.edit_mode_active:
return forms.Media(
css={
**rte_config.css,
@@ -33,7 +33,7 @@ def media(self):
js=(
static("djangocms_text/bundles/bundle.editor.min.js"),
*(static(js) for js in rte_config.js),
- ),
+ ) if self.inline_editing else (),
)
return forms.Media()
diff --git a/djangocms_text/contrib/text_ckeditor4/__init__.py b/djangocms_text/contrib/text_ckeditor4/__init__.py
index 2a82fa2e..51d3fd46 100644
--- a/djangocms_text/contrib/text_ckeditor4/__init__.py
+++ b/djangocms_text/contrib/text_ckeditor4/__init__.py
@@ -1,5 +1,6 @@
from djangocms_text.editors import RTEConfig
+
ckeditor4 = RTEConfig(
name="ckeditor4",
config="CKEDITOR",
diff --git a/djangocms_text/contrib/text_ckeditor5/__init__.py b/djangocms_text/contrib/text_ckeditor5/__init__.py
index 9c3d5fcd..2678d8c4 100644
--- a/djangocms_text/contrib/text_ckeditor5/__init__.py
+++ b/djangocms_text/contrib/text_ckeditor5/__init__.py
@@ -1,5 +1,6 @@
from djangocms_text.editors import RTEConfig
+
ckeditor5 = RTEConfig(
name="ckeditor5",
config="CKEDITOR5",
diff --git a/djangocms_text/editors.py b/djangocms_text/editors.py
index ed281ba3..5a3e40ad 100644
--- a/djangocms_text/editors.py
+++ b/djangocms_text/editors.py
@@ -1,13 +1,10 @@
from typing import Iterable, Optional
from django.conf import settings
-
-
-from django.utils.translation import gettext_lazy as _
-
-from django.utils.functional import Promise
-from django.utils.encoding import force_str
from django.core.serializers.json import DjangoJSONEncoder
+from django.utils.encoding import force_str
+from django.utils.functional import Promise
+from django.utils.translation import gettext_lazy as _
class LazyEncoder(DjangoJSONEncoder):
diff --git a/djangocms_text/html.py b/djangocms_text/html.py
index 32f8981d..d9867be6 100644
--- a/djangocms_text/html.py
+++ b/djangocms_text/html.py
@@ -6,12 +6,11 @@
from copy import deepcopy
from typing import Optional, Union
-import nh3
from django.apps import apps
-from lxml import etree
-
from django.db import models
+import nh3
+from lxml import etree
from lxml.etree import Element
from . import settings
diff --git a/djangocms_text/models.py b/djangocms_text/models.py
index 6a152144..c3207000 100644
--- a/djangocms_text/models.py
+++ b/djangocms_text/models.py
@@ -10,12 +10,7 @@
from . import settings
from .html import clean_html, extract_images
-from .utils import (
- plugin_tags_to_db,
- plugin_tags_to_id_list,
- plugin_to_tag,
- replace_plugin_tags,
-)
+from .utils import plugin_tags_to_db, plugin_tags_to_id_list, plugin_to_tag, replace_plugin_tags
try:
diff --git a/djangocms_text/settings.py b/djangocms_text/settings.py
index 73fcaaa6..2a1574c8 100644
--- a/djangocms_text/settings.py
+++ b/djangocms_text/settings.py
@@ -41,5 +41,5 @@
TEXT_INLINE_EDITING = getattr(settings, "TEXT_INLINE_EDITING", False)
TEXT_CHILDREN_ENABLED = getattr(settings, "TEXT_CHILDREN_ENABLED", True)
-TEXT_CHILDREN_WHITELIST = getattr(settings, "TEXT_CHILDREN_WHITELIST", [])
+TEXT_CHILDREN_WHITELIST = getattr(settings, "TEXT_CHILDREN_WHITELIST", None)
TEXT_CHILDREN_BLACKLIST = getattr(settings, "TEXT_CHILDREN_BLACKLIST", [])
diff --git a/djangocms_text/static/djangocms_text/css/cms.text.css b/djangocms_text/static/djangocms_text/css/cms.text.css
index 0ca2162c..184ff125 100644
--- a/djangocms_text/static/djangocms_text/css/cms.text.css
+++ b/djangocms_text/static/djangocms_text/css/cms.text.css
@@ -16,3 +16,155 @@
display: none;
}
}
+
+
+#cms-top dialog.cms-dialog {
+ padding: 0;
+ resize: both;
+ top: 50%;
+ left: 50%;
+ inset-inline-start: 50%;
+ inset-inline-end: unset;
+ transform: translate(calc(-50% + 250px), calc(-50% + 121px));
+ width: 32rem;
+ height: 24rem;
+ min-height: 16rem;
+ min-width: 16rem;
+ .cms-modal-foot {
+ margin-inline-end: 1rem;
+ .cms-modal-buttons {
+ padding-inline-end: 10px;
+ }
+ }
+ .cms-modal-body iframe {
+ width: 100%;
+ height: 100%;
+ border: none;
+ }
+}
+
+[dir="rtl"] dialog.cms-dialog {
+ inset-inline-start: unset;
+ inset-inline-end: 50%;
+}
+
+dialog.cms-form-dialog {
+ &::before {
+ position: absolute;
+ background: var(--dca-white);
+ border: 1px solid var(--dca-gray-light);
+ box-shadow: 0 0 10px rgba(var(--dca-shadow), .25);
+ height: 10px;
+ width: 10px;
+ left: 24px;
+ top: 8px;
+ transform: rotate(-135deg);
+ transform-origin: 0 0;
+ content: "";
+ }
+ &.right::before {
+ right: 24px;
+ left: auto;
+ }
+ &::after {
+ position: absolute;
+ background: var(--dca-white);
+ height: 10px;
+ left: 10px;
+ top: 0;
+ width: 40px;
+ content: "";
+ }
+ &.right::after {
+ right: 10px;
+ left: auto;
+ }
+ .dropback {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: -1;
+ cursor: unset; /* browser default */
+ }
+ z-index: 1001;
+ position: fixed;
+ margin: unset;
+ left: auto;
+ transform: translate(-50%, -50%);
+ min-width: 200px;
+ padding: 10px 15px;
+ background-color: var(--dca-white);
+ border: 1px solid var(--dca-gray-light);
+ border-radius: 5px;
+ box-shadow: 0 0 10px rgba(var(--dca-shadow), .25);
+ form {
+ display: flex;
+ flex-flow: row;
+ justify-content: space-between;
+ align-content: baseline;
+ align-items: center;
+ }
+ .cancel {
+ display: inline-flex;
+ color: #f00;
+ margin-left: 0.5em;
+ margin-right: 0.5em;
+ cursor: pointer;
+ }
+ .submit {
+ display: inline-flex;
+ color: #693;
+ cursor: pointer;
+ }
+}
+
+
+form.cms-form {
+ display: flex;
+ flex-flow: row;
+ justify-content: space-between;
+ align-content: baseline;
+ align-items: center;
+ text-align: start;
+ zoom: 1;
+ input, select {
+ min-width: 200px;
+ width: 100%;
+ margin-bottom: 3px;
+ font-size: 0.8rem;
+ min-height: 1rem;
+ line-height: unset;
+ height: unset;
+ padding: 3px 6px !important;
+ }
+ select { /* !important for djangocms-admin-style */
+ background: var(--dca-white) url('data:image/svg+xml;utf8,') no-repeat right center !important;
+ background-size: auto 1em !important;
+ appearance: none;
+ }
+ label {
+ font-size: 0.7rem;
+ padding-bottom: 4px;
+ }
+ hr {
+ margin: 0.3em -1em;
+ }
+ .cms-form-buttons {
+ display: inline-flex;
+ margin-inline-start: 1em;
+ .cancel {
+ color: #f00;
+ cursor: pointer;
+ zoom: 1.2;
+ }
+ .submit {
+ margin-left: 0.5em;
+ margin-right: 0.5em;
+ color: #693;
+ cursor: pointer;
+ zoom: 1.2;
+ }
+ }
+}
diff --git a/djangocms_text/widgets.py b/djangocms_text/widgets.py
index 5207d4ea..f3fd32bb 100644
--- a/djangocms_text/widgets.py
+++ b/djangocms_text/widgets.py
@@ -14,8 +14,9 @@
from cms.utils.urlutils import admin_reverse, static_with_version
from . import settings as text_settings
-from .editors import DEFAULT_TOOLBAR_CMS, DEFAULT_TOOLBAR_HTMLField, LazyEncoder, get_editor_base_config
-from .editors import get_editor_config
+from .editors import (
+ DEFAULT_TOOLBAR_CMS, DEFAULT_TOOLBAR_HTMLField, LazyEncoder, get_editor_base_config, get_editor_config,
+)
from .utils import cms_placeholder_add_plugin
diff --git a/private/css/cms.dialog.css b/private/css/cms.dialog.css
deleted file mode 100644
index bfae06ee..00000000
--- a/private/css/cms.dialog.css
+++ /dev/null
@@ -1,151 +0,0 @@
-
-dialog.cms-dialog {
- padding: 0;
- resize: both;
- top: 50%;
- left: 50%;
- inset-inline-start: 50%;
- inset-inline-end: unset;
- transform: translate(calc(-50% + 250px), calc(-50% + 121px));
- width: 32rem;
- height: 24rem;
- min-height: 16rem;
- min-width: 16rem;
- .cms-modal-foot {
- margin-inline-end: 1rem;
- .cms-modal-buttons {
- padding-inline-end: 10px;
- }
- }
- .cms-modal-body iframe {
- width: 100%;
- height: 100%;
- border: none;
- }
-}
-
-[dir="rtl"] dialog.cms-dialog {
- inset-inline-start: unset;
- inset-inline-end: 50%;
-}
-
-dialog.cms-form-dialog {
- &::before {
- position: absolute;
- background: var(--dca-white);
- border: 1px solid var(--dca-gray-light);
- box-shadow: 0 0 10px rgba(var(--dca-shadow), .25);
- height: 10px;
- width: 10px;
- left: 24px;
- top: 8px;
- transform: rotate(-135deg);
- transform-origin: 0 0;
- content: "";
- }
- &.right::before {
- right: 24px;
- left: auto;
- }
- &::after {
- position: absolute;
- background: var(--dca-white);
- height: 10px;
- left: 10px;
- top: 0;
- width: 40px;
- content: "";
- }
- &.right::after {
- right: 10px;
- left: auto;
- }
- .dropback {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: -1;
- cursor: unset; /* browser default */
- }
- z-index: 1001;
- position: fixed;
- margin: unset;
- left: auto;
- transform: translate(-50%, -50%);
- min-width: 200px;
- padding: 10px 15px;
- background-color: var(--dca-white);
- border: 1px solid var(--dca-gray-light);
- border-radius: 5px;
- box-shadow: 0 0 10px rgba(var(--dca-shadow), .25);
- form {
- display: flex;
- flex-flow: row;
- justify-content: space-between;
- align-content: baseline;
- align-items: center;
- }
- .cancel {
- display: inline-flex;
- color: #f00;
- margin-left: 0.5em;
- margin-right: 0.5em;
- cursor: pointer;
- }
- .submit {
- display: inline-flex;
- color: #693;
- cursor: pointer;
- }
-}
-
-
-form.cms-form {
- display: flex;
- flex-flow: row;
- justify-content: space-between;
- align-content: baseline;
- align-items: center;
- text-align: start;
- zoom: 1;
- input, select {
- min-width: 200px;
- width: 100%;
- margin-bottom: 3px;
- font-size: 0.8rem;
- min-height: 1rem;
- line-height: unset;
- height: unset;
- padding: 3px 6px !important;
- }
- select { /* !important for djangocms-admin-style */
- background: var(--dca-white) url('data:image/svg+xml;utf8,') no-repeat right center !important;
- background-size: auto 1em !important;
- appearance: none;
- }
- label {
- font-size: 0.7rem;
- padding-bottom: 4px;
- }
- hr {
- margin: 0.3em -1em;
- }
- .cms-form-buttons {
- display: inline-flex;
- margin-inline-start: 1em;
- .cancel {
- color: #f00;
- cursor: pointer;
- zoom: 1.2;
- }
- .submit {
- margin-left: 0.5em;
- margin-right: 0.5em;
- color: #693;
- cursor: pointer;
- zoom: 1.2;
- }
- }
-}
diff --git a/private/js/cms.dialog.js b/private/js/cms.dialog.js
index 6ada08d6..bea2521c 100644
--- a/private/js/cms.dialog.js
+++ b/private/js/cms.dialog.js
@@ -2,8 +2,6 @@
/* jshint esversion: 6 */
/* global document, window, console */
-import "../css/cms.dialog.css";
-
class CmsDialog {
/**
* Constructor for creating an instance of the class whowing a django CMS modal in a