feat: Listen to xBlock interaction events #35694
Draft
+57
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several changes to improve the handling of XBlock events and the user interface in the CMS. The most important changes include adding event listeners for message handling, refining the
postMessage
logic, and updating the CSS for better visual consistency.Event Handling Improvements:
cms/static/js/views/container.js
: Added apostMessage
call to refresh positions when updating elements, with error handling for robustness.cms/static/js/views/pages/container.js
: Added an event listener formessage
events to re-render the page when receiving arefreshXBlock
message.Refinements to
postMessage
Logic:cms/static/js/views/pages/container.js
: Updated theeditXBlock
method to send amanageXBlockAccess
message with additional payload data when the target element has theaccess-button
class.cms/static/js/views/pages/container.js
: Modified the logic to handle new XBlock editor URLs and send anewXBlockEditor
message with the URL in the payload, including error handling.cms/static/js/views/pages/container.js
: RefinedpostMessage
calls forcopyXBlock
,duplicateXBlock
, anddeleteXBlock
actions to include the XBlock locator in the payload and return immediately after sending the message. [1] [2] [3]CSS Updates:
cms/static/sass/course-unit-mfe-iframe-bundle.scss
: Added a color change on hover for better visual feedback.cms/static/sass/course-unit-mfe-iframe-bundle.scss
: Increased thez-index
for.wrapper-nav-sub
within.xblock-header-primary
to ensure proper stacking context.