1
0
mirror of https://github.com/hakimel/reveal.js.git synced 2025-08-11 09:04:51 +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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -209,6 +209,9 @@ const Plugin = () => {
deck.on( 'overviewshown', post );
deck.on( 'paused', post );
deck.on( 'resumed', post );
deck.on( 'showmediapreview', post );
deck.on( 'showiframepreview', post );
deck.on( 'closeoverlay', post );
// Post the initial state
post();

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 );
}
}