From 1e3042d7a0b908f11c6ac84577794136dadb73ab Mon Sep 17 00:00:00 2001 From: fofolee Date: Sun, 8 May 2022 18:00:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E4=B8=AD=E6=96=87=E6=9C=AC=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=80=89=E9=A1=B9=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandRunResult.vue | 69 +++++++++-------------------- src/components/popup/ResultMenu.vue | 55 +++++++++++++++++++++++ 2 files changed, 77 insertions(+), 47 deletions(-) create mode 100644 src/components/popup/ResultMenu.vue diff --git a/src/components/CommandRunResult.vue b/src/components/CommandRunResult.vue index ef33acf..7cc06f4 100644 --- a/src/components/CommandRunResult.vue +++ b/src/components/CommandRunResult.vue @@ -30,39 +30,15 @@ 运行结果 - - 将 DataUrl 转为图片 - 复制到剪贴板 - 发送到活动窗口 - - +
+ + + @@ -90,12 +70,14 @@ import outputTypes from "../js/options/outputTypes.js"; import specialVars from "../js/options/specialVars.js"; import commandTypes from "../js/options/commandTypes.js"; import ResultArea from "components/ResultArea.vue"; +import ResultMenu from "components/popup/ResultMenu.vue"; export default { - components: { ResultArea }, + components: { ResultArea, ResultMenu }, data() { return { isResultShow: false, + selectText: null, runResult: [], runResultStatus: true, subInputValue: "", @@ -364,21 +346,14 @@ export default { } return [html.documentElement.innerHTML]; }, - copyResult() { - utools.copyText(this.runResult.join("\n")); - quickcommand.showMessageBox("已复制到剪贴板"); + selectHandler() { + this.selectText = window.getSelection().toString().trim(); }, - sendResult() { - utools.copyText(this.runResult.join("\n")); - utools.hideMainWindow(); - quickcommand.simulatePaste(); + clearSelect() { + window.getSelection().removeAllRanges(); + this.selectText = null; }, - dataUrlToImg() { - let imgs = this.runResult - .join("\n") - .match(/data:image\/.*?;base64,.*/g) - ?.map((dataUrl) => `
`); - if (!imgs) return quickcommand.showMessageBox("dataUrl 格式不正确!"); + showBase64Img(imgs) { this.runResult = []; this.enableHtml = true; this.showRunResult(imgs, true); diff --git a/src/components/popup/ResultMenu.vue b/src/components/popup/ResultMenu.vue new file mode 100644 index 0000000..0745a77 --- /dev/null +++ b/src/components/popup/ResultMenu.vue @@ -0,0 +1,55 @@ + + +