From f9c01f0a7df89aef6a00df801d3f224480caf572 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Wed, 25 May 2022 22:14:08 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=81=8A=E5=A4=A9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=8F=AF=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/js/pages/manage/components/DialogView.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/pages/manage/components/DialogView.vue b/resources/assets/js/pages/manage/components/DialogView.vue index 891353528..8ed5e7344 100644 --- a/resources/assets/js/pages/manage/components/DialogView.vue +++ b/resources/assets/js/pages/manage/components/DialogView.vue @@ -211,8 +211,17 @@ export default { text = text.trim().replace(/(\n\x20*){3,}/g, "\n\n"); text = text.replace(/\{\{RemoteURL\}\}/g, $A.apiUrl('../')) text = text.replace(/

<\/p>/g, '


') - // text = text.replace(/(https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;)+)/g, "$1$2"); text = text.replace(this.atUserReg, ``) + // 处理内容连接 + if (/https*:\/\//.test(text)) { + text = text.split(/(<[^>]*>)/g).map(string => { + if (string && !/<[^>]*>/.test(string)) { + string = string.replace(/(https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;)+)/g, "$1$2") + } + return string; + }).join("") + } + // 处理图片显示尺寸 const array = text.match(/]*?>/g); if (array) { const widthReg = new RegExp("width=\"(\\d+)\"")