mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-29 12:22:44 +08:00
修复导出时存在 html 标签的 bug
This commit is contained in:
parent
3a7085ac31
commit
6a2254f68f
@ -418,6 +418,10 @@ window.htmlEncode = (value) => {
|
|||||||
return String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """)
|
return String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.removeHtmlTags = value => {
|
||||||
|
return quickcommand.htmlParse(value).querySelector('body').innerText
|
||||||
|
}
|
||||||
|
|
||||||
window.hexEncode = text => Buffer.from(text, 'utf8').toString('hex')
|
window.hexEncode = text => Buffer.from(text, 'utf8').toString('hex')
|
||||||
window.hexDecode = text => Buffer.from(text, 'hex').toString('utf8')
|
window.hexDecode = text => Buffer.from(text, 'hex').toString('utf8')
|
||||||
window.base64Decode = text => Buffer.from(text, 'base64').toString('utf8')
|
window.base64Decode = text => Buffer.from(text, 'base64').toString('utf8')
|
||||||
|
@ -85,7 +85,11 @@
|
|||||||
<q-card-section>
|
<q-card-section>
|
||||||
<!-- logo -->
|
<!-- logo -->
|
||||||
<div class="row" :class="cardStyleVars.logoPosition">
|
<div class="row" :class="cardStyleVars.logoPosition">
|
||||||
<q-img width="48px" height="48px" :src="commandInfo.features.icon" />
|
<q-img
|
||||||
|
width="48px"
|
||||||
|
height="48px"
|
||||||
|
:src="commandInfo.features.icon"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 名称 -->
|
<!-- 名称 -->
|
||||||
<!-- mini 和 small 模式下命令标题字体变小 -->
|
<!-- mini 和 small 模式下命令标题字体变小 -->
|
||||||
@ -329,21 +333,25 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getAuthedCmd() {
|
getRawCommand() {
|
||||||
let command = _.cloneDeep(this.commandInfo);
|
let command = _.cloneDeep(this.commandInfo);
|
||||||
if (!command.authorName) command.authorName = utools.getUser().nickname;
|
command.features.explain = window.removeHtmlTags(
|
||||||
|
command.features.explain
|
||||||
|
);
|
||||||
return command;
|
return command;
|
||||||
},
|
},
|
||||||
// 导出到剪贴板
|
// 导出到剪贴板
|
||||||
exportCommandRaw() {
|
exportCommandRaw() {
|
||||||
utools.copyText(JSON.stringify(this.getAuthedCmd(), null, 4)) &&
|
utools.copyText(JSON.stringify(this.getRawCommand(), null, 4)) &&
|
||||||
quickcommand.showMessageBox("已复制到剪贴板");
|
quickcommand.showMessageBox("已复制到剪贴板");
|
||||||
},
|
},
|
||||||
// 导出到文件
|
// 导出到文件
|
||||||
exportCommandFile() {
|
exportCommandFile() {
|
||||||
window.saveFile(JSON.stringify(this.getAuthedCmd()), {
|
window.saveFile(JSON.stringify(this.getRawCommand()), {
|
||||||
title: "选择保存位置",
|
title: "选择保存位置",
|
||||||
defaultPath: `${this.getAuthedCmd().features.explain}.json`,
|
defaultPath: `${window.removeHtmlTags(
|
||||||
|
this.commandInfo.features.explain
|
||||||
|
)}.json`,
|
||||||
filters: [{ name: "json", extensions: ["json"] }],
|
filters: [{ name: "json", extensions: ["json"] }],
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user