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 => {