From ecf3c2b8496e75e7873661845326061c037bd10a Mon Sep 17 00:00:00 2001 From: fofolee Date: Fri, 6 May 2022 11:21:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9E=9C=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E6=96=B0=E5=A2=9E=E6=93=8D=E4=BD=9C=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandRunResult.vue | 144 ++++++++++++++++++++-------- src/components/ResultArea.vue | 2 +- 2 files changed, 107 insertions(+), 39 deletions(-) diff --git a/src/components/CommandRunResult.vue b/src/components/CommandRunResult.vue index e88a421..ef33acf 100644 --- a/src/components/CommandRunResult.vue +++ b/src/components/CommandRunResult.vue @@ -1,47 +1,86 @@ @@ -91,7 +130,13 @@ export default { return ["edit", "new", "config"].includes(this.action.type); }, maxHeight() { - return this.fromUtools ? 600 : 300; + return this.fromUtools ? 600 : 400; + }, + headerHeight() { + return this.enableHtml && this.fromUtools ? 0 : 40; + }, + isDataUrl() { + return this.runResult.join("").includes("data:image/"); }, }, methods: { @@ -270,7 +315,10 @@ export default { // 根据输出自动滚动及调整 utools 高度 autoHeight(e) { if (!this.fromUtools) return; - let pluginHeight = e.height < this.maxHeight ? e.height : this.maxHeight; + let pluginHeight = + e.height + this.headerHeight < this.maxHeight + ? e.height + this.headerHeight + : this.maxHeight; utools.setExpendHeight(pluginHeight); }, autoScroll() { @@ -292,6 +340,7 @@ export default { document.removeEventListener("keydown", this.subInputListener, true); } this.clear(); + this.frameInitHeight = 0; }, clear() { !!this.ctrlCListener && @@ -315,6 +364,25 @@ export default { } return [html.documentElement.innerHTML]; }, + copyResult() { + utools.copyText(this.runResult.join("\n")); + quickcommand.showMessageBox("已复制到剪贴板"); + }, + sendResult() { + utools.copyText(this.runResult.join("\n")); + utools.hideMainWindow(); + quickcommand.simulatePaste(); + }, + dataUrlToImg() { + let imgs = this.runResult + .join("\n") + .match(/data:image\/.*?;base64,.*/g) + ?.map((dataUrl) => `
`); + if (!imgs) return quickcommand.showMessageBox("dataUrl 格式不正确!"); + this.runResult = []; + this.enableHtml = true; + this.showRunResult(imgs, true); + }, }, unmounted() { this.stopRun(); diff --git a/src/components/ResultArea.vue b/src/components/ResultArea.vue index 73e9eb3..f4b25e3 100644 --- a/src/components/ResultArea.vue +++ b/src/components/ResultArea.vue @@ -13,7 +13,7 @@ v-else v-show="!!runResult" :class="{ 'text-red': !runResultStatus }" - class="text q-pa-md" + class="text q-px-md q-py-sm" >