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(