From 6a2254f68f2ab83c594f38d6e7535cf6dd82e3b9 Mon Sep 17 00:00:00 2001 From: fofolee Date: Sat, 16 Apr 2022 10:18:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E6=97=B6?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=20html=20=20=E6=A0=87=E7=AD=BE=E7=9A=84=20bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/preload.js | 4 ++++ src/components/CommandCard.vue | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/plugin/preload.js b/plugin/preload.js index 4cf9ae8..90c0fbf 100644 --- a/plugin/preload.js +++ b/plugin/preload.js @@ -418,6 +418,10 @@ window.htmlEncode = (value) => { return String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/ { + return quickcommand.htmlParse(value).querySelector('body').innerText +} + window.hexEncode = text => Buffer.from(text, 'utf8').toString('hex') window.hexDecode = text => Buffer.from(text, 'hex').toString('utf8') window.base64Decode = text => Buffer.from(text, 'base64').toString('utf8') diff --git a/src/components/CommandCard.vue b/src/components/CommandCard.vue index 37af94c..b23c1b5 100644 --- a/src/components/CommandCard.vue +++ b/src/components/CommandCard.vue @@ -85,7 +85,11 @@
- +
@@ -329,21 +333,25 @@ export default { }); }); }, - getAuthedCmd() { + getRawCommand() { let command = _.cloneDeep(this.commandInfo); - if (!command.authorName) command.authorName = utools.getUser().nickname; + command.features.explain = window.removeHtmlTags( + command.features.explain + ); return command; }, // 导出到剪贴板 exportCommandRaw() { - utools.copyText(JSON.stringify(this.getAuthedCmd(), null, 4)) && + utools.copyText(JSON.stringify(this.getRawCommand(), null, 4)) && quickcommand.showMessageBox("已复制到剪贴板"); }, // 导出到文件 exportCommandFile() { - window.saveFile(JSON.stringify(this.getAuthedCmd()), { + window.saveFile(JSON.stringify(this.getRawCommand()), { title: "选择保存位置", - defaultPath: `${this.getAuthedCmd().features.explain}.json`, + defaultPath: `${window.removeHtmlTags( + this.commandInfo.features.explain + )}.json`, filters: [{ name: "json", extensions: ["json"] }], }); },