Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit 4a22b8b

Browse files
authored
fix: Inline editing workaround for toolbar bug in django CMS <= 3.9 (#619)
* Add: Workaround for the toolbar bug in django CMS < 3.10
1 parent f03f40b commit 4a22b8b

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Unreleased
66
==========
77

88
* Removed inline editing toggle button from touch devices (where it is inactive anyways) and collapsed menus
9-
9+
* Add workaround for toolbar bug in django CMS < 3.10: Reload page after change in inline editor
1010

1111
5.1.0 (2022-03-24)
1212
==================

djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/cms.ckeditor.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,23 @@
256256
},
257257

258258
loadToolbar: function () {
259-
CMS.API.StructureBoard._loadToolbar()
260-
.done(function (newToolbar) {
261-
CMS.API.Toolbar._refreshMarkup($(newToolbar).find('.cms-toolbar'));
262-
})
263-
.fail(CMS.API.Helpers.reloadBrowser);
259+
if (CMS.settings && CMS.settings.version && this._toolbar_bug_version(CMS.settings.version)) {
260+
// Before django CMS 3.10 a bug prevents the toolbar to be loaded correctly
261+
// Refresh whole page instead
262+
CMS.API.Helpers.reloadBrowser();
263+
} else {
264+
CMS.API.StructureBoard._loadToolbar()
265+
.done(function (newToolbar) {
266+
CMS.API.Toolbar._refreshMarkup($(newToolbar).find('.cms-toolbar'));
267+
})
268+
.fail(CMS.API.Helpers.reloadBrowser);
269+
}
270+
},
271+
272+
_toolbar_bug_version: function (version) {
273+
var parts = version.split('.');
274+
275+
return parts[0] === '3' && parts[1].length < 2;
264276
},
265277

266278
storeCSSlinks: function () {

djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/bundle-3d3a4963e8.cms.ckeditor.min.js renamed to djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/bundle-5f73f48756.cms.ckeditor.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

djangocms_text_ckeditor/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
# this path is changed automatically whenever you run `gulp bundle`
19-
PATH_TO_JS = 'djangocms_text_ckeditor/js/dist/bundle-3d3a4963e8.cms.ckeditor.min.js'
19+
PATH_TO_JS = 'djangocms_text_ckeditor/js/dist/bundle-5f73f48756.cms.ckeditor.min.js'
2020

2121

2222
class TextEditorWidget(forms.Textarea):

0 commit comments

Comments
 (0)