From 75cceef27f36b6199d5e1d680d503ed2d0e03d46 Mon Sep 17 00:00:00 2001 From: XnpioChV Date: Fri, 13 Dec 2024 14:39:16 -0500 Subject: [PATCH 1/2] feat: Send message when cancel button is clicked on xblock_v2 iframe --- common/templates/xblock_v2/xblock_iframe.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/templates/xblock_v2/xblock_iframe.html b/common/templates/xblock_v2/xblock_iframe.html index 8b733373bd82..bf3326eb1986 100644 --- a/common/templates/xblock_v2/xblock_iframe.html +++ b/common/templates/xblock_v2/xblock_iframe.html @@ -322,5 +322,12 @@ window.addEventListener('load', blockFrameJS); + From be646dfe9b40b4efc7111c2237a8bc07c8215b65 Mon Sep 17 00:00:00 2001 From: XnpioChV Date: Mon, 16 Dec 2024 12:23:01 -0500 Subject: [PATCH 2/2] fix: add notify() to render in xblock_v2 to fix save block --- common/templates/xblock_v2/xblock_iframe.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/templates/xblock_v2/xblock_iframe.html b/common/templates/xblock_v2/xblock_iframe.html index bf3326eb1986..853c05605344 100644 --- a/common/templates/xblock_v2/xblock_iframe.html +++ b/common/templates/xblock_v2/xblock_iframe.html @@ -215,6 +215,13 @@ } return url; }, + notify: () => { + /** + * Used in `studio_view` + * + * TODO: Do nothing for now + * **/ + } }; /** @@ -328,6 +335,10 @@ event.preventDefault(); window.parent.postMessage('cancel-clicked', '*'); }); + document.querySelector('.save-button').addEventListener('click', function() { + event.preventDefault(); + window.parent.postMessage('save-clicked', '*'); + });