mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-14 18:16:59 +08:00
Merge branch 'quickcommand3' of https://github.com/fofolee/uTools-quickcommand into quickcommand3
This commit is contained in:
commit
c4c4c2c803
@ -206,10 +206,10 @@ export default defineComponent({
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||||
background: rgba(194, 194, 194, 0.4);
|
background: rgba(194, 194, 194, 0.4);
|
||||||
|
border: rgba(194, 194, 194, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
::-webkit-scrollbar-track-piece {
|
||||||
border-radius: 10px;
|
background: rgba(194, 194, 194, 0.1);
|
||||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,47 +1,86 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div v-if="!fromUtools">
|
<q-dialog
|
||||||
<q-dialog v-model="isResultShow" position="bottom" @hide="stopRun">
|
v-model="isResultShow"
|
||||||
<q-card style="max-width: 700px; min-width: 700px; overflow: hidden">
|
:position="fromUtools ? 'top' : 'bottom'"
|
||||||
<q-toolbar>
|
@hide="stopRun"
|
||||||
<q-avatar>
|
:maximized="fromUtools"
|
||||||
|
:transition-duration="fromUtools ? 0 : 200"
|
||||||
|
>
|
||||||
|
<q-card
|
||||||
|
:style="{
|
||||||
|
maxWidth: fromUtools ? '100%' : '700px',
|
||||||
|
width: fromUtools ? '100%' : '700px',
|
||||||
|
overflow: 'hidden',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-if="!(enableHtml && fromUtools)"
|
||||||
|
:style="{
|
||||||
|
height: headerHeight + 'px',
|
||||||
|
}"
|
||||||
|
class="flex items-center justify-between"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<q-avatar :size="`${headerHeight}`">
|
||||||
<q-icon
|
<q-icon
|
||||||
:class="runResultStatus ? 'text-green' : 'text-red'"
|
:class="runResultStatus ? 'text-green' : 'text-red'"
|
||||||
style="font-size: 30px"
|
|
||||||
:name="runResultStatus ? 'task_alt' : 'error'"
|
:name="runResultStatus ? 'task_alt' : 'error'"
|
||||||
></q-icon>
|
></q-icon>
|
||||||
</q-avatar>
|
</q-avatar>
|
||||||
<q-toolbar-title
|
<span class="text-weight-bold text-h6">运行结果</span>
|
||||||
><span class="text-weight-bold">运行结果</span></q-toolbar-title
|
|
||||||
>
|
|
||||||
<q-btn flat round icon="close" color="negative" v-close-popup />
|
|
||||||
</q-toolbar>
|
|
||||||
<div style="max-height: calc(100% - 50px)" class="scroll">
|
|
||||||
<ResultArea
|
|
||||||
v-if="isResultShow"
|
|
||||||
@frameLoad="frameLoad"
|
|
||||||
:frameInitHeight="frameInitHeight"
|
|
||||||
:enableHtml="enableHtml"
|
|
||||||
:runResultStatus="runResultStatus"
|
|
||||||
:runResult="runResult"
|
|
||||||
:key="timeStamp"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
<q-btn-group stretch class="no-shadow">
|
||||||
</q-dialog>
|
<q-btn
|
||||||
</div>
|
flat
|
||||||
<div v-else>
|
icon="image"
|
||||||
<ResultArea
|
color="primary"
|
||||||
v-if="isResultShow"
|
@click="dataUrlToImg"
|
||||||
@frameLoad="frameLoad"
|
v-show="isDataUrl && !enableHtml"
|
||||||
:frameInitHeight="frameInitHeight"
|
><q-tooltip>将 DataUrl 转为图片</q-tooltip></q-btn
|
||||||
:enableHtml="enableHtml"
|
>
|
||||||
:runResultStatus="runResultStatus"
|
<q-btn
|
||||||
:runResult="runResult"
|
flat
|
||||||
:key="timeStamp"
|
icon="content_paste"
|
||||||
/>
|
color="primary"
|
||||||
</div>
|
@click="copyResult"
|
||||||
<q-resize-observer @resize="autoHeight" debounce="0" />
|
v-show="!enableHtml"
|
||||||
|
><q-tooltip>复制到剪贴板</q-tooltip></q-btn
|
||||||
|
>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
icon="send"
|
||||||
|
color="primary"
|
||||||
|
@click="sendResult"
|
||||||
|
v-show="!enableHtml"
|
||||||
|
><q-tooltip>发送到活动窗口</q-tooltip></q-btn
|
||||||
|
>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
icon="close"
|
||||||
|
color="negative"
|
||||||
|
v-close-popup
|
||||||
|
v-show="!fromUtools"
|
||||||
|
/>
|
||||||
|
</q-btn-group>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
:style="{ maxHeight: maxHeight - headerHeight + 'px' }"
|
||||||
|
class="scroll"
|
||||||
|
>
|
||||||
|
<ResultArea
|
||||||
|
v-if="isResultShow"
|
||||||
|
@frameLoad="frameLoad"
|
||||||
|
:frameInitHeight="frameInitHeight"
|
||||||
|
:enableHtml="enableHtml"
|
||||||
|
:runResultStatus="runResultStatus"
|
||||||
|
:runResult="runResult"
|
||||||
|
:key="timeStamp"
|
||||||
|
/>
|
||||||
|
<q-resize-observer @resize="autoHeight" debounce="0" />
|
||||||
|
</div>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -91,7 +130,13 @@ export default {
|
|||||||
return ["edit", "new", "config"].includes(this.action.type);
|
return ["edit", "new", "config"].includes(this.action.type);
|
||||||
},
|
},
|
||||||
maxHeight() {
|
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: {
|
methods: {
|
||||||
@ -270,7 +315,10 @@ export default {
|
|||||||
// 根据输出自动滚动及调整 utools 高度
|
// 根据输出自动滚动及调整 utools 高度
|
||||||
autoHeight(e) {
|
autoHeight(e) {
|
||||||
if (!this.fromUtools) return;
|
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);
|
utools.setExpendHeight(pluginHeight);
|
||||||
},
|
},
|
||||||
autoScroll() {
|
autoScroll() {
|
||||||
@ -292,6 +340,7 @@ export default {
|
|||||||
document.removeEventListener("keydown", this.subInputListener, true);
|
document.removeEventListener("keydown", this.subInputListener, true);
|
||||||
}
|
}
|
||||||
this.clear();
|
this.clear();
|
||||||
|
this.frameInitHeight = 0;
|
||||||
},
|
},
|
||||||
clear() {
|
clear() {
|
||||||
!!this.ctrlCListener &&
|
!!this.ctrlCListener &&
|
||||||
@ -315,6 +364,25 @@ export default {
|
|||||||
}
|
}
|
||||||
return [html.documentElement.innerHTML];
|
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) => `<img src="${dataUrl}"><br>`);
|
||||||
|
if (!imgs) return quickcommand.showMessageBox("dataUrl 格式不正确!");
|
||||||
|
this.runResult = [];
|
||||||
|
this.enableHtml = true;
|
||||||
|
this.showRunResult(imgs, true);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
this.stopRun();
|
this.stopRun();
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
v-else
|
v-else
|
||||||
v-show="!!runResult"
|
v-show="!!runResult"
|
||||||
:class="{ 'text-red': !runResultStatus }"
|
:class="{ 'text-red': !runResultStatus }"
|
||||||
class="text q-pa-md"
|
class="text q-px-md q-py-sm"
|
||||||
>
|
>
|
||||||
<div v-for="item in runResult" :key="item">
|
<div v-for="item in runResult" :key="item">
|
||||||
<ObjectTree :obj="item" v-if="typeof item === 'object'" />
|
<ObjectTree :obj="item" v-if="typeof item === 'object'" />
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-card>
|
<q-card @contextmenu="mouseHandler">
|
||||||
<q-virtual-scroll
|
<q-virtual-scroll
|
||||||
ref="scrollBar"
|
ref="scrollBar"
|
||||||
@scroll="scrollHandler"
|
@scroll="scrollHandler"
|
||||||
@ -198,17 +198,11 @@ export default {
|
|||||||
clear() {
|
clear() {
|
||||||
utools.removeSubInput();
|
utools.removeSubInput();
|
||||||
document.removeEventListener("keydown", this.keyHandler);
|
document.removeEventListener("keydown", this.keyHandler);
|
||||||
document.removeEventListener("wheel", this.mouseHandler, {
|
|
||||||
passive: false,
|
|
||||||
});
|
|
||||||
this.setUtoolsHeight(this.listMaxHeight);
|
this.setUtoolsHeight(this.listMaxHeight);
|
||||||
},
|
},
|
||||||
|
|
||||||
addListeners() {
|
addListeners() {
|
||||||
document.addEventListener("keydown", this.keyHandler);
|
document.addEventListener("keydown", this.keyHandler);
|
||||||
document.addEventListener("wheel", this.mouseHandler, {
|
|
||||||
passive: false,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user