Skip to content

Commit

Permalink
feat: Send message when cancel button is clicked on xblock_v2 iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Dec 13, 2024
1 parent 971afe6 commit 75cceef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions common/templates/xblock_v2/xblock_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -322,5 +322,12 @@

window.addEventListener('load', blockFrameJS);
</script>
<script>
// Used when rendering the `studio_view`, in order to intercept and handle the cancel button event
document.querySelector('.cancel-button').addEventListener('click', function() {
event.preventDefault();
window.parent.postMessage('cancel-clicked', '*');
});
</script>
</body>
</html>

0 comments on commit 75cceef

Please sign in to comment.