PM: html2pptx v3 - fix slide detection to direct children only
- deck.querySelectorAll('.ppt-slide') -> deck.querySelectorAll(':scope > .ppt-slide')
prevents nested .ppt-slide elements from being counted as separate slides
- Enhanced visibility filter: check opacity, display, visibility in addition to rect size
- Tested: dashi-deck.html now returns 14 slides (was 20), simple.html returns 10
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+6
-2
@@ -158,7 +158,7 @@ async function main() {
|
||||
// DashiAI format: .ppt-deck > .ppt-slide
|
||||
var deck = document.querySelector('.ppt-deck');
|
||||
if (deck) {
|
||||
slides = deck.querySelectorAll('.ppt-slide');
|
||||
slides = deck.querySelectorAll(':scope > .ppt-slide');
|
||||
}
|
||||
if (!slides || slides.length <= 1) {
|
||||
slides = document.querySelectorAll(
|
||||
@@ -170,7 +170,11 @@ async function main() {
|
||||
}
|
||||
slides = Array.from(slides).filter(function (s) {
|
||||
var r = s.getBoundingClientRect();
|
||||
return r.width > 0 && r.height > 0;
|
||||
var style = window.getComputedStyle(s);
|
||||
return r.width > 0 && r.height > 0 &&
|
||||
style.opacity !== '0' &&
|
||||
style.display !== 'none' &&
|
||||
style.visibility !== 'hidden';
|
||||
});
|
||||
|
||||
// Tags whose full text content should be a single text box
|
||||
|
||||
Reference in New Issue
Block a user