mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-05 12:29:44 +08:00
fix bug: 深色模式对话导出渲染不正确
This commit is contained in:
parent
653b133327
commit
b04f02ea96
@ -306,7 +306,18 @@ export const captureScrollableDiv = async (divRef: React.RefObject<HTMLDivElemen
|
|||||||
allowTaint: true, // Allow cross-origin images
|
allowTaint: true, // Allow cross-origin images
|
||||||
logging: false, // Disable logging
|
logging: false, // Disable logging
|
||||||
imageTimeout: 0, // Disable image timeout
|
imageTimeout: 0, // Disable image timeout
|
||||||
|
backgroundColor: null,
|
||||||
onclone: (clonedDoc) => {
|
onclone: (clonedDoc) => {
|
||||||
|
// 克隆时保留原始样式
|
||||||
|
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
|
// Ensure all images in cloned document are loaded
|
||||||
const images = clonedDoc.getElementsByTagName('img')
|
const images = clonedDoc.getElementsByTagName('img')
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user