diff --git a/assets/runtime.js b/assets/runtime.js index 1afea73..835659a 100644 --- a/assets/runtime.js +++ b/assets/runtime.js @@ -160,13 +160,18 @@ }; }); - // Collect all stylesheets from current document + // Collect all stylesheets — use absolute URLs so popup can resolve them const styleSheets = Array.from(document.querySelectorAll('link[rel="stylesheet"], style')).map(el => { if (el.tagName === 'LINK') return ''; return ''; }).join('\n'); - const presenterHTML = buildPresenterHTML(slideData, styleSheets, total, idx); + // Collect body classes (e.g. tpl-presenter-mode-reveal) so scoped CSS works + const bodyClasses = document.body.className || ''; + // Collect attributes for theme variables + const htmlAttrs = Array.from(root.attributes).map(a => a.name+'="'+a.value+'"').join(' '); + + const presenterHTML = buildPresenterHTML(slideData, styleSheets, total, idx, bodyClasses, htmlAttrs); presenterWin = window.open('', 'html-ppt-presenter', 'width=1200,height=800,menubar=no,toolbar=no'); if (!presenterWin) { @@ -178,36 +183,40 @@ presenterWin.document.close(); } - function buildPresenterHTML(slideData, styleSheets, total, startIdx) { - // Escape backticks and ${ in slide HTML for template literal safety + function buildPresenterHTML(slideData, styleSheets, total, startIdx, bodyClasses, htmlAttrs) { const slidesJSON = JSON.stringify(slideData); return '\n' -+ '\n
\n\n' ++ '\n\n\n' + '