From 9f299df3a01f0476651f3a4271db1133b21b0d2f Mon Sep 17 00:00:00 2001 From: Arunmozhi Date: Wed, 16 Apr 2025 02:30:31 +1000 Subject: [PATCH] feat: adds scrollToXBlock message handler for cms iframe view (#36478) This commit adds a new message handler to the XBlockContainerPage CMS view, that allows the MFE to send a signal to the IFrame and scroll to a specific XBlock. --- cms/static/js/views/pages/container.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cms/static/js/views/pages/container.js b/cms/static/js/views/pages/container.js index 684bd0ab7d..b483b98f11 100644 --- a/cms/static/js/views/pages/container.js +++ b/cms/static/js/views/pages/container.js @@ -169,6 +169,9 @@ function($, _, Backbone, gettext, BasePage, case 'addXBlock': this.createComponent(this, xblockElement, data); break; + case 'scrollToXBlock': + document.getElementById(data.payload.locator)?.scrollIntoView({behavior: "smooth"}); + break; default: console.warn('Unhandled message type:', data.type); }