From a787ee6404b6ba40641efdbb0a627d7c48f54197 Mon Sep 17 00:00:00 2001 From: eoao Date: Thu, 5 Jun 2025 23:09:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=98=9F=E6=A0=87=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E6=9F=A5=E7=9C=8B=EF=BC=8C=E9=99=84=E4=BB=B6=E7=AD=89?= =?UTF-8?q?=E5=A4=9A=E4=B8=AAbug=EF=BC=8C=E4=BC=98=E5=8C=96=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/email-scroll/index.vue | 16 ++++++--- mail-vue/src/components/shadow-html/index.vue | 18 +++++++--- mail-vue/src/layout/main/index.vue | 2 +- mail-vue/src/views/login/index.vue | 4 +-- mail-vue/src/views/role/index.vue | 2 +- mail-vue/src/views/user/index.vue | 7 ++-- .../{index-CT6Gv1uc.js => index-DWsyDqKg.js} | 34 +++++++++---------- ...{index-3kOBVh6Q.css => index-DeM-iAnI.css} | 2 +- mail-worker/dist/index.html | 4 +-- mail-worker/src/email/email.js | 3 +- mail-worker/src/service/account-service.js | 4 +-- mail-worker/src/service/att-service.js | 7 +++- mail-worker/src/service/star-service.js | 13 +++++-- 13 files changed, 74 insertions(+), 42 deletions(-) rename mail-worker/dist/assets/{index-CT6Gv1uc.js => index-DWsyDqKg.js} (79%) rename mail-worker/dist/assets/{index-3kOBVh6Q.css => index-DeM-iAnI.css} (97%) diff --git a/mail-vue/src/components/email-scroll/index.vue b/mail-vue/src/components/email-scroll/index.vue index afaa04f..164ed05 100644 --- a/mail-vue/src/components/email-scroll/index.vue +++ b/mail-vue/src/components/email-scroll/index.vue @@ -25,7 +25,7 @@
- +
@@ -274,18 +274,26 @@ function htmlToText(email) { tempDiv.innerHTML = email.content; const scriptsAndStyles = tempDiv.querySelectorAll('script, style, title'); scriptsAndStyles.forEach(el => el.remove()); - const text = tempDiv.textContent || tempDiv.innerText || ''; - return text.replace(/\s+/g, ' ').trim(); + let text = tempDiv.textContent || tempDiv.innerText || ''; + text = text.replace(/\s+/g, ' ').trim(); + return cleanSpace(text) } if (email.text) { - return email.text + return cleanSpace(email.text) } else { return '' } } +function cleanSpace(text) { + return text + .replace(/[\u200B-\u200F\uFEFF]/g, '') // 移除零宽空格、ZWNJ、ZWJ、LRM、RLM、BOM + .replace(/\s+/g, ' ') // 多空白合并成一个空格 + .trim(); +} + function starChange(email) { diff --git a/mail-vue/src/components/shadow-html/index.vue b/mail-vue/src/components/shadow-html/index.vue index 5fba995..f02c3c2 100644 --- a/mail-vue/src/components/shadow-html/index.vue +++ b/mail-vue/src/components/shadow-html/index.vue @@ -32,8 +32,17 @@ function loadFontInShadow() { } function updateContent() { - if (!shadowRoot) return + if (!shadowRoot) return; + // 1. 提取 的 style 属性(如果存在) + const bodyStyleRegex = /]*style="([^"]*)"[^>]*>/i; + const bodyStyleMatch = props.html.match(bodyStyleRegex); + const bodyStyle = bodyStyleMatch ? bodyStyleMatch[1] : ''; + + // 2. 移除 标签(保留内容) + const cleanedHtml = props.html.replace(/<\/?body[^>]*>/gi, ''); + + // 3. 将 body 的 style 应用到 .shadow-content shadowRoot.innerHTML = `
- ${props.html} + ${cleanedHtml}
- ` + `; } function autoScale() { @@ -109,6 +118,7 @@ onMounted(() => { shadowRoot = container.value.attachShadow({ mode: 'open' }) updateContent() autoScale() + console.log(props.html) }) watch(() => props.html, () => { diff --git a/mail-vue/src/layout/main/index.vue b/mail-vue/src/layout/main/index.vue index 5c652ab..47c8994 100644 --- a/mail-vue/src/layout/main/index.vue +++ b/mail-vue/src/layout/main/index.vue @@ -96,7 +96,7 @@ const handleResize = () => { .main-box-show { display: grid; - grid-template-columns: 250px 1fr; + grid-template-columns: 260px 1fr; height: calc(100% - 60px); @media (max-width: 1200px) { grid-template-columns: 250px 1fr; diff --git a/mail-vue/src/views/login/index.vue b/mail-vue/src/views/login/index.vue index dcd60c5..9f5f5e9 100644 --- a/mail-vue/src/views/login/index.vue +++ b/mail-vue/src/views/login/index.vue @@ -11,8 +11,8 @@
{{settingStore.settings.title}} - 请输入你的账号信息以开始使用邮箱系统 - 请输入你的账号密码以开始注册邮箱系统 + 请输入账号信息以开始使用邮箱系统 + 请输入账号密码以开始注册邮箱系统