🚀 run plugins with the space key

This commit is contained in:
layyback 2022-04-03 13:36:39 +08:00
parent 9613c24deb
commit e1ccbb69a5

View File

@ -1,7 +1,10 @@
<template> <template>
<div class="rubick-select"> <div class="rubick-select">
<div class="select-tag" v-show="currentPlugin.cmd">{{ currentPlugin.cmd }}</div> <div class="select-tag" v-show="currentPlugin.cmd">{{ currentPlugin.cmd }}</div>
<div :class="clipboardFile[0].name ? 'clipboard-tag' : 'clipboard-img'" v-if="!!clipboardFile.length"> <div
:class="clipboardFile[0].name ? 'clipboard-tag' : 'clipboard-img'"
v-if="!!clipboardFile.length"
>
<img :src="getIcon()" /> <img :src="getIcon()" />
<div class="ellipse">{{ clipboardFile[0].name }}</div> <div class="ellipse">{{ clipboardFile[0].name }}</div>
<a-tag color="#aaa" v-if="clipboardFile.length > 1">{{ clipboardFile.length }}</a-tag> <a-tag color="#aaa" v-if="clipboardFile.length > 1">{{ clipboardFile.length }}</a-tag>
@ -20,11 +23,8 @@
@focus="emit('focus')" @focus="emit('focus')"
> >
<template #suffix> <template #suffix>
<div class="suffix-tool" > <div class="suffix-tool">
<MoreOutlined <MoreOutlined @click="showSeparate()" class="icon-more" />
@click="showSeparate()"
class="icon-more"
/>
<div v-if="currentPlugin && currentPlugin.logo" style="position: relative"> <div v-if="currentPlugin && currentPlugin.logo" style="position: relative">
<a-spin v-show="pluginLoading" class="loading"> <a-spin v-show="pluginLoading" class="loading">
<template #indicator> <template #indicator>
@ -96,6 +96,7 @@ const keydownEvent = (e, key: string) => {
modifiers, modifiers,
}, },
}); });
const runPluginDisable = e.target.value === "" || props.currentPlugin.name
switch (key) { switch (key) {
case "up": case "up":
emit("changeCurrent", -1); emit("changeCurrent", -1);
@ -104,15 +105,13 @@ const keydownEvent = (e, key: string) => {
emit("changeCurrent", 1); emit("changeCurrent", 1);
break; break;
case "enter": case "enter":
if (e.target.value === "" || props.currentPlugin.name) return; if (runPluginDisable) return;
emit("choosePlugin"); emit("choosePlugin");
break; break;
case "space": case "space":
if (e.target.value === "" || props.currentPlugin.name) return; if (runPluginDisable || !opConfig.get().perf.common.space) return;
if (!opConfig.get().perf.common.space) return;
emit("choosePlugin"); emit("choosePlugin");
break; break;
default: default:
break; break;
} }
@ -241,13 +240,16 @@ const newWindow = () => {
border: none; border: none;
outline: none; outline: none;
box-shadow: none !important; box-shadow: none !important;
.ant-select-selection, .ant-input, .ant-select-selection__rendered { .ant-select-selection,
.ant-input,
.ant-select-selection__rendered {
height: 100% !important; height: 100% !important;
font-size: 22px; font-size: 22px;
border: none !important; border: none !important;
} }
} }
.rubick-logo, .icon-tool { .rubick-logo,
.icon-tool {
width: 40px; width: 40px;
height: 40px; height: 40px;
background: #574778; background: #574778;