1
0
mirror of https://github.com/hakimel/reveal.js.git synced 2025-08-13 10:04:45 +02:00

sync lightbox between speaker/main window (fixes #3771)

This commit is contained in:
Hakim El Hattab
2025-03-25 10:42:41 +01:00
parent ac4064b64d
commit aa9dfc7eb8
11 changed files with 74 additions and 20 deletions

View File

@@ -414,14 +414,23 @@
}
// Messages sent by the reveal.js inside of the current slide preview
else if( data && data.namespace === 'reveal' ) {
const supportedEvents = [
'slidechanged',
'fragmentshown',
'fragmenthidden',
'paused',
'resumed',
'showiframepreview',
'showmediapreview',
'closeoverlay'
];
if( /ready/.test( data.eventName ) ) {
// Send a message back to notify that the handshake is complete
window.opener.postMessage( JSON.stringify({ namespace: 'reveal-notes', type: 'connected'} ), '*' );
}
else if( /slidechanged|fragmentshown|fragmenthidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
else if( supportedEvents.includes( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
dispatchStateToMainWindow( data.state );
}
}