From b04f02ea96befddc7a09adcd61febdc609699290 Mon Sep 17 00:00:00 2001 From: eeee0717 Date: Tue, 25 Feb 2025 17:36:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug:=20=E6=B7=B1=E8=89=B2=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=AF=B9=E8=AF=9D=E5=AF=BC=E5=87=BA=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/utils/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/renderer/src/utils/index.ts b/src/renderer/src/utils/index.ts index da01710bd1..1a3c04fd9c 100644 --- a/src/renderer/src/utils/index.ts +++ b/src/renderer/src/utils/index.ts @@ -306,7 +306,18 @@ export const captureScrollableDiv = async (divRef: React.RefObject { + // 克隆时保留原始样式 + if (div.id) { + const clonedDiv = clonedDoc.querySelector(`#${div.id}`) as HTMLElement + if (clonedDiv) { + const computedStyle = getComputedStyle(div) + clonedDiv.style.backgroundColor = computedStyle.backgroundColor + clonedDiv.style.color = computedStyle.color + } + } + // Ensure all images in cloned document are loaded const images = clonedDoc.getElementsByTagName('img') return Promise.all(