From 4452fa985f7bf5c4ed3e99da3d918e9bdd6c8e31 Mon Sep 17 00:00:00 2001 From: KID-joker Date: Sat, 6 Jul 2024 12:04:24 +0800 Subject: [PATCH] fix(#6): treat the flexible layout element as a whole --- paginate-dom/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paginate-dom/index.ts b/paginate-dom/index.ts index f3431af..8dad4ce 100644 --- a/paginate-dom/index.ts +++ b/paginate-dom/index.ts @@ -216,7 +216,10 @@ export default function paginate(options: { else if (typeof cut !== "boolean") { stack.push(cut); if (cut.top < expected_page_bottom && !force_closest_tag_names.has(cut.tagName)) { - node = cut.node.firstChild; + const style = window.getComputedStyle(cut.node as HTMLElement); + if (style.display !== 'flex' || !style.flexDirection.startsWith('row')) { + node = cut.node.firstChild; + } } } }