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"] }], }); },