mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-29 01:02:47 +08:00
使搜索框在存在输入内容时mousedown不会造成拖动
This commit is contained in:
parent
1eeb0fad9a
commit
9d3e7fc4a5
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,12 +1,21 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
dist/
|
||||||
dist/electron/*
|
dist/electron/*
|
||||||
dist/web/*
|
dist/web/*
|
||||||
|
|
||||||
build/*
|
build/*
|
||||||
!build/icons/
|
!build/icons/
|
||||||
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
npm-debug.log.*
|
npm-debug.log.*
|
||||||
|
.pnpm-debug.log
|
||||||
|
|
||||||
thumbs.db
|
thumbs.db
|
||||||
!.gitkeep
|
!.gitkeep
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
dist/
|
.vscode
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"0 debug pnpm:scope": {
|
|
||||||
"selected": 1
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div @mousedown="drag" >
|
<div @mousedown="drag">
|
||||||
<a-layout id="components-layout">
|
<a-layout id="components-layout">
|
||||||
<div v-if="!searchType" class="rubick-select">
|
<div v-if="!searchType" class="rubick-select">
|
||||||
<div class="tag-container" v-if="selected">
|
<div class="tag-container" v-if="selected">
|
||||||
<a-tag
|
<a-tag
|
||||||
@ -16,23 +16,26 @@
|
|||||||
<a-input
|
<a-input
|
||||||
id="search"
|
id="search"
|
||||||
:placeholder="
|
:placeholder="
|
||||||
subPlaceHolder && selected && selected.key === 'plugin-container'
|
subPlaceHolder && selected && selected.key === 'plugin-container'
|
||||||
? subPlaceHolder
|
? subPlaceHolder
|
||||||
: 'Hi, Rubick'
|
: 'Hi, Rubick'
|
||||||
"
|
"
|
||||||
|
@mousedown.stop="dragWhenInput"
|
||||||
class="main-input"
|
class="main-input"
|
||||||
@change="(e) => search({ value: e.target.value })"
|
@change="(e) => search({ value: e.target.value })"
|
||||||
@keydown.ctrl.86="shouldPaste"
|
@keydown.ctrl.86="shouldPaste"
|
||||||
:value="searchValue"
|
:value="searchValue"
|
||||||
:maxLength="selected && selected.key !== 'plugin-container' ? 0 : 1000"
|
:maxLength="
|
||||||
|
selected && selected.key !== 'plugin-container' ? 0 : 1000
|
||||||
|
"
|
||||||
@keydown.down="(e) => changeCurrent(1)"
|
@keydown.down="(e) => changeCurrent(1)"
|
||||||
@keydown.up="() => changeCurrent(-1)"
|
@keydown.up="() => changeCurrent(-1)"
|
||||||
@keypress.enter="
|
@keypress.enter="
|
||||||
(e) => targetSearch({ value: e.target.value, type: 'enter' })
|
(e) => targetSearch({ value: e.target.value, type: 'enter' })
|
||||||
"
|
"
|
||||||
@keypress.space="
|
@keypress.space="
|
||||||
(e) => targetSearch({ value: e.target.value, type: 'space' })
|
(e) => targetSearch({ value: e.target.value, type: 'space' })
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<div @click="goMenu" class="suffix-tool" slot="suffix">
|
<div @click="goMenu" class="suffix-tool" slot="suffix">
|
||||||
<a-icon
|
<a-icon
|
||||||
@ -42,12 +45,14 @@
|
|||||||
/>
|
/>
|
||||||
<div v-if="selected && selected.icon" style="position: relative">
|
<div v-if="selected && selected.icon" style="position: relative">
|
||||||
<a-spin v-show="pluginLoading" class="loading">
|
<a-spin v-show="pluginLoading" class="loading">
|
||||||
<a-icon slot="indicator" type="loading" style="font-size: 42px" spin />
|
<a-icon
|
||||||
|
slot="indicator"
|
||||||
|
type="loading"
|
||||||
|
style="font-size: 42px"
|
||||||
|
spin
|
||||||
|
/>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
<img
|
<img class="icon-tool" :src="selected.icon" />
|
||||||
class="icon-tool"
|
|
||||||
:src="selected.icon"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="rubick-logo">
|
<div v-else class="rubick-logo">
|
||||||
<img src="./assets/imgs/logo.png" />
|
<img src="./assets/imgs/logo.png" />
|
||||||
@ -87,19 +92,19 @@
|
|||||||
:placeholder="subPlaceHolder"
|
:placeholder="subPlaceHolder"
|
||||||
class="sub-input"
|
class="sub-input"
|
||||||
@change="
|
@change="
|
||||||
(e) =>
|
(e) =>
|
||||||
search({
|
search({
|
||||||
value: e.target.value,
|
value: e.target.value,
|
||||||
searchType: pluginInfo.searchType,
|
searchType: pluginInfo.searchType,
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
:value="searchValue"
|
:value="searchValue"
|
||||||
@keypress.enter="
|
@keypress.enter="
|
||||||
(e) => targetSearch({ value: e.target.value, type: 'enter' })
|
(e) => targetSearch({ value: e.target.value, type: 'enter' })
|
||||||
"
|
"
|
||||||
@keypress.space="
|
@keypress.space="
|
||||||
(e) => targetSearch({ value: e.target.value, type: 'space' })
|
(e) => targetSearch({ value: e.target.value, type: 'space' })
|
||||||
"
|
"
|
||||||
></a-input>
|
></a-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -167,20 +172,21 @@ export default {
|
|||||||
const feature = plugin.features;
|
const feature = plugin.features;
|
||||||
feature.forEach((fe) => {
|
feature.forEach((fe) => {
|
||||||
const cmd = searchKeyValues(fe.cmds, args)[0];
|
const cmd = searchKeyValues(fe.cmds, args)[0];
|
||||||
const systemPlugin = fileLists.filter(
|
const systemPlugin = fileLists.filter((plugin) => {
|
||||||
(plugin) => {
|
let has = false;
|
||||||
let has = false;
|
plugin.keyWords.some((keyWord) => {
|
||||||
plugin.keyWords.some(keyWord => {
|
if (
|
||||||
if (keyWord.toLocaleUpperCase().indexOf(args.toLocaleUpperCase()) >= 0) {
|
keyWord.toLocaleUpperCase().indexOf(args.toLocaleUpperCase()) >=
|
||||||
has = keyWord;
|
0
|
||||||
plugin.name = keyWord;
|
) {
|
||||||
return true;
|
has = keyWord;
|
||||||
}
|
plugin.name = keyWord;
|
||||||
return false;
|
return true;
|
||||||
});
|
}
|
||||||
return has;
|
return false;
|
||||||
}
|
});
|
||||||
)[0];
|
return has;
|
||||||
|
})[0];
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
config = {
|
config = {
|
||||||
cmd: cmd,
|
cmd: cmd,
|
||||||
@ -210,11 +216,14 @@ export default {
|
|||||||
...mapActions("main", ["onSearch", "showMainUI", "openPlugin"]),
|
...mapActions("main", ["onSearch", "showMainUI", "openPlugin"]),
|
||||||
...mapMutations("main", ["commonUpdate"]),
|
...mapMutations("main", ["commonUpdate"]),
|
||||||
shouldPaste(e) {
|
shouldPaste(e) {
|
||||||
let filePath = '';
|
let filePath = "";
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === "win32") {
|
||||||
const rawFilePath = clipboard.read('FileNameW');
|
const rawFilePath = clipboard.read("FileNameW");
|
||||||
filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), 'g'), '');
|
filePath = rawFilePath.replace(
|
||||||
if (filePath.indexOf('plugin.json') >= 0) {
|
new RegExp(String.fromCharCode(0), "g"),
|
||||||
|
""
|
||||||
|
);
|
||||||
|
if (filePath.indexOf("plugin.json") >= 0) {
|
||||||
this.search({
|
this.search({
|
||||||
filePath,
|
filePath,
|
||||||
});
|
});
|
||||||
@ -340,8 +349,13 @@ export default {
|
|||||||
this.changePath({ key: "market" });
|
this.changePath({ key: "market" });
|
||||||
},
|
},
|
||||||
drag() {
|
drag() {
|
||||||
ipcRenderer.send('window-move');
|
ipcRenderer.send("window-move");
|
||||||
}
|
},
|
||||||
|
dragWhenInput(e) {
|
||||||
|
if (this.searchValue == "") {
|
||||||
|
ipcRenderer.send("window-move");
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState("main", [
|
...mapState("main", [
|
||||||
@ -479,7 +493,7 @@ export default {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.loading {
|
.loading {
|
||||||
position:absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user