From 64b1d20b3291c70a562b046d9124181375643db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com> Date: Wed, 15 Apr 2026 13:09:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8E=92=E7=89=88=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/page/GenerateCharts.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/page/GenerateCharts.vue b/src/components/page/GenerateCharts.vue index 653bb6e..4896df4 100644 --- a/src/components/page/GenerateCharts.vue +++ b/src/components/page/GenerateCharts.vue @@ -1679,13 +1679,13 @@ export default { }, async onDrop(event, dataId) { - const loading = this.$loading({ + if (event.dataTransfer.getData('image')) { + const loading = this.$loading({ lock: true, text: 'Loading...', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' }); - if (event.dataTransfer.getData('image')) { const draggedImage = JSON.parse(event.dataTransfer.getData('image')); const draggedImageIndex = JSON.parse(event.dataTransfer.getData('imageIndex')); this.$nextTick(async () => { @@ -1712,7 +1712,13 @@ export default { this.$message.error(err.msg); }); }); - } else { + } else if(event.dataTransfer.getData('table')) { + const loading = this.$loading({ + lock: true, + text: 'Loading...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }); const draggedtable = JSON.parse(event.dataTransfer.getData('table')); this.$nextTick(async () => { @@ -1739,6 +1745,8 @@ export default { this.$message.error(err.msg); }); }); + }else{ + } }, getCommentList() { From 1e2e8146cc6cece6c1af51b9abc8e06b154b536b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com> Date: Thu, 16 Apr 2026 11:02:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AE=A1=E7=A8=BF=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/js/commonJS.js | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/common/js/commonJS.js b/src/common/js/commonJS.js index eae4459..3f15913 100644 --- a/src/common/js/commonJS.js +++ b/src/common/js/commonJS.js @@ -1246,35 +1246,28 @@ str = str.replace(regex, function (match, content, offset, fullString) { getCleanTextForCount(html) { if (!html) return ""; - - // 创建临时容器解析 HTML const tempDiv = document.createElement('div'); tempDiv.innerHTML = html; - // A. 特殊处理 wmath:只拿它里面的公式文本,扔掉里面生成的 mjx-container 等标签 + // 1. 处理公式 (保留公式文本内容) const wmaths = tempDiv.querySelectorAll('wmath'); wmaths.forEach(wm => { - // textContent 会拿到最原始的公式字符,忽略内部所有标签 - const textNode = document.createTextNode(wm.textContent); + const textNode = document.createTextNode(" " + wm.textContent + " "); wm.parentNode.replaceChild(textNode, wm); }); - // B. 获取现在的 HTML 内容 - let result = tempDiv.innerHTML; + // 2. 移除所有引用标签 [1], [2] (防止用户靠狂刷引用来凑字数) + const refs = tempDiv.querySelectorAll('span.reference-link, a.ref'); // 根据你系统的 class 名调整 + refs.forEach(r => r.remove()); - // C. 去掉特定排版标签的“壳”(保留里面的文字) - // 包含 b, strong, br, em, i, sup, sub 等 - result = result.replace(/<(p|div|b|strong|br|em|i|sup|sub)[^>]*>/gi, ""); - result = result.replace(/<\/(p|div|b|strong|br|em|i|sup|sub)>/gi, ""); + // 3. 获取纯文本 (textContent 是浏览器原生方法,能处理所有标签及其属性) + let text = tempDiv.textContent || tempDiv.innerText || ""; - - - // E. 彻底“脱水”:去掉 HTML 实体、换行符、所有空格 - result = result.replace(/ /ig, ""); - result = result.replace(/[\r\n\t]/g, ""); - result = result.replace(/\s+/g, ""); - - return result; + // 4. 标准化空格:将 HTML 实体、换行、多个空格统一转为一个空格 + return text.replace(/ /ig, " ") + .replace(/[\r\n\t]+/g, " ") + .replace(/\s+/g, " ") + .trim(); },