diff --git a/src/components/editor/CommandSideBar.vue b/src/components/editor/CommandSideBar.vue
index 75588a3..b10e2ed 100644
--- a/src/components/editor/CommandSideBar.vue
+++ b/src/components/editor/CommandSideBar.vue
@@ -18,7 +18,7 @@
icon="arrow_back_ios_new"
v-close-popup
class="absolute-left"
- style="height: 48px"
+ style="height: 48px; width: 22px"
/>
@@ -64,13 +64,7 @@
transition-hide="jump-up"
borderless
square
- @update:model-value="
- (val) =>
- (cmdMatch =
- val.name === 'professional'
- ? JSON.stringify(val.jsonSample, null, 4)
- : null)
- "
+ @update:model-value="(val) => handleCmdTypeChange(val)"
:options="commandTypesOptions"
v-model="cmdType"
type="text"
@@ -93,13 +87,13 @@
+
+
+
+ 切换匹配类型,当前:{{
+ isFileTypeDirectory ? "文件夹" : "文件"
+ }}
+
+
+
-
-
-
- {{
- currentCommand.features.mainPush
- ? "主搜索执行"
- : "进插件执行"
- }}
-
-
-
-
-
+
+
+
+ {{ scope.opt.label }}
+ {{ scope.opt.desc }}
+
+
+
+
+
-
+
opt.value === this.currentCommand.features.mainPush
+ ) || this.searchPushOptions[0]
+ );
+ },
+ set(option) {
+ this.currentCommand.features.mainPush = option.value;
+ },
+ },
},
watch: {
outputTypesOptionsDy(val) {
@@ -435,10 +463,11 @@ export default {
let cmds = this.quickcommandInfo.features?.cmds;
if (!cmds) return data;
if (cmds.length === 1) {
- let { type, match } = cmds[0];
+ let { type, match, fileType } = cmds[0];
data.type = type ? type : "key";
data.match =
data.type === "key" ? cmds : match?.app ? match.app : match;
+ this.isFileTypeDirectory = fileType === "directory";
} else {
data.type = cmds.filter((x) => !x.length).length
? "professional"
@@ -447,6 +476,12 @@ export default {
}
return data;
},
+ handleCmdTypeChange(val) {
+ this.cmdMatch =
+ val.name === "professional"
+ ? JSON.stringify(val.jsonSample, null, 4)
+ : null;
+ },
tagVerify(val, done) {
if (
[
@@ -508,8 +543,16 @@ export default {
if (verify !== true) {
return quickcommand.showMessageBox(verify, "error");
}
+ // 匹配文件时,额外添加文件类型
+ let rules = this.cmdMatch;
+ if (this.cmdType.name === "files") {
+ rules = {
+ fileType: this.isFileTypeDirectory ? "directory" : "file",
+ match: this.cmdMatch,
+ };
+ }
updateData.features.cmds = this.cmdType.matchToCmds(
- this.cmdMatch,
+ rules,
updateData.features.explain
);
@@ -562,7 +605,7 @@ export default {
border-radius: 8px;
padding: 4px;
color: #f4f4f4;
- font-size: 16px;
+ font-size: 14px;
/* 分开设置不同属性的过渡效果 */
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
@@ -580,17 +623,12 @@ export default {
transform: scale(1.05) translateY(-1px) translateZ(0);
background: var(--q-primary);
opacity: 0.9;
- /* 移除font-size变化 */
}
-/* 输入框获得焦点时的图标效果 */
+/* 输入框得焦点时的图标效果 */
.q-field--focused .command-side-bar-icon {
transform: scale(1.1) translateY(-1px) translateZ(0);
background: var(--q-primary);
opacity: 0.85;
}
-
-/* .command-side-bar-content {
- width: 171px;
-} */
diff --git a/src/js/options/commandTypes.js b/src/js/options/commandTypes.js
index 781701f..846ce16 100644
--- a/src/js/options/commandTypes.js
+++ b/src/js/options/commandTypes.js
@@ -159,8 +159,9 @@ const commandTypes = {
matchToCmds: (rules, desc) => [{
type: "files",
label: desc,
- match: rules,
- "minLength": 1,
+ match: rules.match,
+ fileType: rules.fileType,
+ minLength: 1,
}, ],
verify: rules => !!rules > 0 || "正则不能为空",
tempPayload: () => window.convertFilePathToUtoolsPayload(utools.showOpenDialog({