fix: save scroll position on exit from video xblock fullscreen mode

This commit is contained in:
ihor-romaniuk
2022-09-28 18:03:46 +03:00
committed by leangseu-edx
parent 1a58d864e0
commit efe40657b4

View File

@@ -193,6 +193,18 @@
this.resizer.delta.reset().setMode('width');
}
this.el.trigger('fullscreen', [this.isFullScreen]);
if (window !== window.parent) {
// This is used by the Learning MFE to know about closing fullscreen mode.
// The MFE is then able to respond appropriately and scroll window to the previous position.
window.parent.postMessage({
type: 'plugin.videoFullScreen',
payload: {
open: false
}
}, document.referrer
);
}
}
function handleEnter() {
@@ -203,6 +215,18 @@
return;
}
if (window !== window.parent) {
// This is used by the Learning MFE to know about opening fullscreen mode.
// The MFE is then able to respond appropriately and save the window scroll position.
window.parent.postMessage({
type: 'plugin.videoFullScreen',
payload: {
open: true
}
}, document.referrer
);
}
this.videoFullScreen.fullScreenState = this.isFullScreen = true;
fullScreenClassNameEl.addClass('video-fullscreen');
this.videoFullScreen.fullScreenEl