Skip to content

Commit dbc117c

Browse files
authored
fix: Text-enabled plugins could not be added in django CMS 3.x (#99)
1 parent 2ac41e8 commit dbc117c

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Changelog
33
=========
44

5+
0.8.8 (05-06-2025)
6+
==================
7+
* fix: Text-enabled plugins could not be added in django CMS 3.x
8+
59
0.8.7 (30-05-2025)
610
==================
711
* fix: table icons of inline ckeditor respect dark mode by @PeterW-LWL in https://github.com/django-cms/djangocms-text/pull/92

djangocms_text/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
10. Github actions will publish the new package to pypi
1717
"""
1818

19-
__version__ = "0.8.7"
19+
__version__ = "0.8.8"

private/js/cms.editor.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,9 @@ class CMSEditor {
492492
if (script && script.textContent.length > 2) {
493493
this.CMS.API.Helpers.dataBridge = JSON.parse(script.textContent);
494494
} else {
495-
const regex1 = /^\s*Window\.CMS\.API\.Helpers\.dataBridge\s=\s(.*?);$/gmu.exec(dom.innerHTML);
496-
const regex2 = /^\s*Window\.CMS\.API\.Helpers\.dataBridge\.structure\s=\s(.*?);$/gmu.exec(dom.innerHTML);
495+
const html = dom.innerHTML;
496+
const regex1 = /^\s*Window\.CMS\.API\.Helpers\.dataBridge\s=\s(.*?);$/gmu.exec(html);
497+
const regex2 = /^\s*Window\.CMS\.API\.Helpers\.dataBridge\.structure\s=\s(.*?);$/gmu.exec(html);
497498

498499
if (regex1 && regex2 && this.CMS) {
499500
this.CMS.API.Helpers.dataBridge = JSON.parse(regex1[1]);
@@ -504,7 +505,9 @@ class CMSEditor {
504505
}
505506
}
506507
// Additional content for the page disrupts inline editing and needs to be removed
507-
delete this.CMS.API.Helpers.dataBridge.structure?.content;
508+
if (this.CMS.API.Helpers.dataBridge?.structure?.content) {
509+
delete this.CMS.API.Helpers.dataBridge.structure.content;
510+
}
508511
}
509512

510513
// CMS Editor: addPluginForm
@@ -565,7 +568,7 @@ class CMSEditor {
565568
// Hook into the django CMS dataBridge to get the details of the newly created or saved
566569
// plugin. For new plugins we need their id to get the content.
567570

568-
this.processDataBridge(form);
571+
this.processDataBridge(form.body);
569572
// Needed to update StructureBoard
570573
if (onSave && this.CMS.API.Helpers.dataBridge) {
571574
onSave(el, form, this.CMS.API.Helpers.dataBridge);

0 commit comments

Comments
 (0)