From 1c5922f2a1189e6814d8add220eda584212c75e7 Mon Sep 17 00:00:00 2001 From: Corey Peterson Date: Wed, 13 May 2026 08:27:16 -0400 Subject: [PATCH] widget player setHeight sends frameResize postMessage to parent frame --- src/components/widget-player.jsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/widget-player.jsx b/src/components/widget-player.jsx index c45c611f4..9c8894086 100644 --- a/src/components/widget-player.jsx +++ b/src/components/widget-player.jsx @@ -368,7 +368,7 @@ const WidgetPlayer = ({instanceId, playId, minHeight=0, minWidth=0,showFooter=tr } else if( ! ['react-devtools-content-script', 'react-devtools-bridge', 'react-devtools-inject-backend'].includes(e.data.source)) { throw new Error( - `Post message Origin does not match. Expected: ${expectedOrigin}, Actual: ${origin}` + `Post message Origin does not match. Expected: ${window.BASE_URL} || ${window.STATIC_CROSSDOMAIN}, Actual: ${origin}` ) } } @@ -544,6 +544,19 @@ const WidgetPlayer = ({instanceId, playId, minHeight=0, minWidth=0,showFooter=tr const min_h = inst.widget.height let desiredHeight = Math.max(h, min_h) setAttributes((oldData) => ({...oldData, height: `${desiredHeight}px`})) + + + const params = new URLSearchParams(window.location.search) + // The presence of the token param indicates an LTI play. Send the frameResize postMessage to the parent frame (the LMS) + if (params.get('token')) { + window.parent.postMessage( + { + subject: 'lti.frameResize', + height: desiredHeight + 60, // add 60 to desiredHeight for footer + }, + '*' + ) + } } const _setVerticalScroll = location => {