From 20e655fd60efe918a58a8c5b870ae25eaedd85a5 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Mon, 9 Oct 2023 11:26:53 -0400 Subject: [PATCH 1/2] Use the current fragment's notes when showNotes: true * js/controllers/notes.js: Use only the current fragment's notes if showing a fragment. * js/reveal.js: Update notes whenever fragments are shown or hidden. Related to: - https://github.com/hakimel/reveal.js/commit/f496613dd3309a3066642adf1261e9da0578cdda - https://github.com/hakimel/reveal.js/pull/1636 --- js/controllers/notes.js | 19 ++++++++++++++++++- js/reveal.js | 9 +++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/js/controllers/notes.js b/js/controllers/notes.js index 7256425e46c..55d6943884c 100644 --- a/js/controllers/notes.js +++ b/js/controllers/notes.js @@ -101,10 +101,27 @@ export default class Notes { return slide.getAttribute( 'data-notes' ); } + if ( Reveal.getConfig().fragments ) { + let fragmentElement = slide.querySelector( '.current-fragment' ); + if( fragmentElement ) { + let fragmentNotes = fragmentElement.querySelector( 'aside.notes' ); + if( fragmentNotes ) { + return fragmentNotes.innerHTML; + } + else if( fragmentElement.hasAttribute( 'data-notes' ) ) { + return fragmentElement.getAttribute( 'data-notes' ); + } + } + } // ... or using