Skip to content

Commit b90a371

Browse files
authored
fix: disable resolveCSSVariables in juice (#1131)
1 parent abc904c commit b90a371

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

apps/web/src/components/editor/editor-header/index.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,16 @@ async function copy() {
140140
141141
setTimeout(() => {
142142
nextTick(async () => {
143-
await processClipboardContent(primaryColor.value)
143+
try {
144+
await processClipboardContent(primaryColor.value)
145+
}
146+
catch (error) {
147+
toast.error(`处理 HTML 失败,请联系开发者。${normalizeErrorMessage(error)}`)
148+
editorRefresh()
149+
emit(`endCopy`)
150+
return
151+
}
152+
144153
const clipboardDiv = document.getElementById(`output`)
145154
146155
if (!clipboardDiv) {

apps/web/src/utils/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ function mergeCss(html: string): string {
253253
return juice(html, {
254254
inlinePseudoElements: true,
255255
preserveImportant: true,
256+
// 禁用 CSS 变量解析,避免 juice 处理时的错误
257+
// 新主题系统已通过 postcss 处理 CSS 变量
258+
resolveCSSVariables: false,
256259
})
257260
}
258261

0 commit comments

Comments
 (0)