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' + 'Presenter View\n' + styleSheets + '\n' + '\n' -+ '\n\n' ++ '\n\n' + '
\n' + '
\n' + '
CURRENT
\n' @@ -239,7 +248,7 @@ + '
00:00
\n' + '
1 / ' + total + '
\n' + '
\n' -+ '
← → 翻页 · R 重置计时 · T 主题 · Esc 关闭
\n' ++ '
← → 翻页 · R 重置计时 · Esc 关闭
\n' + '
\n' + '
\n' + '