mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 22:51:25 +08:00
优化输入框推送功能
This commit is contained in:
parent
7fb35e7c2f
commit
62a9bb01d1
@ -32,6 +32,8 @@ let isProcessExits = pid => {
|
||||
}
|
||||
}
|
||||
|
||||
window.isAppVersion4 = () => utools.getAppVersion() >= "4.0.0";
|
||||
|
||||
// 多开检测
|
||||
window.multiProcessDetection = () => {
|
||||
let pids = JSON.parse(localStorage.getItem('processes')) || [];
|
||||
|
29
src/App.vue
29
src/App.vue
@ -62,20 +62,21 @@ export default defineComponent({
|
||||
this.utools.whole.onPluginEnter((enter) => {
|
||||
this.enterPlugin(enter);
|
||||
});
|
||||
this.utools.whole.onMainPush(
|
||||
async ({ code, type, payload }) => {
|
||||
let result = await this.runCommand(code, payload, 5000);
|
||||
return result.map((x) => {
|
||||
return {
|
||||
text: x,
|
||||
};
|
||||
});
|
||||
},
|
||||
({ code, type, payload, option }) => {
|
||||
window.quickcommand.writeClipboard(option.text);
|
||||
window.utools.showNotification("已复制");
|
||||
}
|
||||
);
|
||||
window.isAppVersion4() &&
|
||||
this.utools.whole.onMainPush(
|
||||
async ({ code, type, payload }) => {
|
||||
let result = await this.runCommand(code, payload, 5000);
|
||||
return result.map((x) => {
|
||||
return {
|
||||
text: x,
|
||||
};
|
||||
});
|
||||
},
|
||||
({ code, type, payload, option }) => {
|
||||
window.quickcommand.writeClipboard(option.text);
|
||||
window.utools.showNotification("已复制");
|
||||
}
|
||||
);
|
||||
this.utools.whole.onPluginOut(() => {
|
||||
this.outPlugin();
|
||||
});
|
||||
|
@ -23,13 +23,37 @@
|
||||
/>
|
||||
</q-avatar>
|
||||
<div class="row">
|
||||
<!-- 搜索面板推送 -->
|
||||
<q-checkbox
|
||||
v-model="currentCommand.features.mainPush"
|
||||
color="primary"
|
||||
label="搜索面板推送"
|
||||
/>
|
||||
<div>
|
||||
<!-- 搜索面板推送 -->
|
||||
<q-field
|
||||
:disable="!canCommandSave"
|
||||
stack-label
|
||||
label-color="primary"
|
||||
borderless
|
||||
square
|
||||
type="text"
|
||||
label="搜索面板推送"
|
||||
>
|
||||
<template v-slot:control>
|
||||
<div class="self-center full-width no-outline" tabindex="0">
|
||||
{{
|
||||
currentCommand.features.mainPush
|
||||
? "主搜索框直接执行"
|
||||
: "进入插件后执行"
|
||||
}}
|
||||
</div>
|
||||
</template>
|
||||
<template v-slot:prepend>
|
||||
<q-icon color="primary" name="troubleshoot" />
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<q-toggle
|
||||
v-model="currentCommand.features.mainPush"
|
||||
color="primary"
|
||||
size="xs"
|
||||
/>
|
||||
</template>
|
||||
</q-field>
|
||||
<!-- 说明 -->
|
||||
<q-input
|
||||
:disable="!canCommandSave"
|
||||
@ -323,8 +347,8 @@ export default {
|
||||
computed: {
|
||||
commandTypesOptions() {
|
||||
return this.currentCommand.features.mainPush
|
||||
? Object.values(commandTypes).filter(
|
||||
(x) => x.name === "regex" || x.name === "over"
|
||||
? Object.values(commandTypes).filter((x) =>
|
||||
["regex", "over", "key"].includes(x.name)
|
||||
)
|
||||
: Object.values(commandTypes);
|
||||
},
|
||||
|
@ -55,7 +55,7 @@ const commandTypes = {
|
||||
icon: "font_download",
|
||||
color: "primary",
|
||||
matchLabel: "关键词",
|
||||
desc: "在主输入框输入对应关键字进入插件,最通用的一种模式,关键字可以设置多个",
|
||||
desc: "直接在主输入框输入对应关键字,最通用的一种模式,关键字可以设置多个",
|
||||
valueType: "array",
|
||||
disabledSpecialVars: /{{input}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}|{{MatchedFiles.*?}}/g,
|
||||
matchToCmds: (rules, desc) => rules,
|
||||
@ -190,4 +190,4 @@ const commandTypes = {
|
||||
}
|
||||
}
|
||||
|
||||
export default commandTypes
|
||||
export default commandTypes
|
||||
|
Loading…
x
Reference in New Issue
Block a user