-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: CMS widgets need not load if they are read only #7880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Yes, this PR fixes the problem. For curiosity, is it intended that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be nicer to write:
window.CMS.Widgets?._pageSelectWidgets?.forEach
@jrief Good news. I hesitate to use optional chaining, since it is "only" supported by newer browsers (~95% according to can I use). django CMS' whole JS code base does not use it and I reckon the two lines are not worth starting to think about compatibility. |
Description
In django CMS 4 form fields that use CMS widgets might be read-only (e.g., if the version is published). In that case, widgets are not loaded into
window.CMS.Widgets
. This PR only activates widgets if they are loaded.Fixes #7879.
This PR does not change any logic (only prevents a js script error to be thrown), hence no tests.
Related resources
Checklist
develop-4