增加图片匹配

This commit is contained in:
fofolee 2022-04-10 12:29:29 +08:00
parent 0cd878adfb
commit c78581bc76
4 changed files with 13 additions and 6 deletions

View File

@ -170,7 +170,7 @@
</q-badge> </q-badge>
</span> </span>
<span v-else-if="cmd.type === 'img'"> <span v-else-if="cmd.type === 'img'">
<q-badge rounded :color="cmdBadgeColor(cmd.type)" label=""> <q-badge rounded :color="cmdBadgeColor(cmd.type)">
<q-icon class="q-mr-xs" :name="commandTypes.img.icon" />图片 <q-icon class="q-mr-xs" :name="commandTypes.img.icon" />图片
</q-badge> </q-badge>
</span> </span>

View File

@ -65,7 +65,7 @@ const commandTypes = {
icon: "rule", icon: "rule",
desc: "匹配主输入框或超级面板选中的文本,可以获取输入框文本或选中文本作为变量", desc: "匹配主输入框或超级面板选中的文本,可以获取输入框文本或选中文本作为变量",
valueType: "regex", valueType: "regex",
disabledSpecialVars: /{{SelectFile}}|{{WindowInfo.*?}}|{{pwd}}|{{MatchedFiles.*?}}/g, disabledSpecialVars: /{{SelectFile}}|{{MatchImage}}|{{WindowInfo.*?}}|{{pwd}}|{{MatchedFiles.*?}}/g,
matchToCmds: (rules, desc) => [{ matchToCmds: (rules, desc) => [{
label: desc, label: desc,
type: "regex", type: "regex",
@ -81,7 +81,7 @@ const commandTypes = {
icon: "emergency", icon: "emergency",
desc: "匹配主输入框的所有文本,但只有在该文本未设置对应的插件或功能时才生效", desc: "匹配主输入框的所有文本,但只有在该文本未设置对应的插件或功能时才生效",
valueType: null, valueType: null,
disabledSpecialVars: /{{SelectFile}}|{{WindowInfo.*?}}|{{pwd}}|{{MatchedFiles.*?}}/g, disabledSpecialVars: /{{SelectFile}}|{{MatchImage}}|{{WindowInfo.*?}}|{{pwd}}|{{MatchedFiles.*?}}/g,
matchToCmds: (rules, desc) => [{ matchToCmds: (rules, desc) => [{
label: desc, label: desc,
type: "over", type: "over",
@ -96,7 +96,7 @@ const commandTypes = {
icon: "widgets", icon: "widgets",
desc: "匹配呼出uTools前或唤出超级面板时的活动窗口可以获取窗口的信息或文件夹路径作为变量", desc: "匹配呼出uTools前或唤出超级面板时的活动窗口可以获取窗口的信息或文件夹路径作为变量",
valueType: "array", valueType: "array",
disabledSpecialVars: /{{input}}|{{MatchedFiles.*?}}/g, disabledSpecialVars: /{{input}}|{{MatchImage}}|{{MatchedFiles.*?}}/g,
matchToCmds: (rules, desc) => [{ matchToCmds: (rules, desc) => [{
type: "window", type: "window",
label: desc, label: desc,
@ -127,7 +127,7 @@ const commandTypes = {
icon: "description", icon: "description",
desc: "匹配主输入框或超级面板选中的文件,可以获取复制及选中的文件信息作为变量", desc: "匹配主输入框或超级面板选中的文件,可以获取复制及选中的文件信息作为变量",
valueType: "regex", valueType: "regex",
disabledSpecialVars: /{{input}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}/g, disabledSpecialVars: /{{input}}|{{MatchImage}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}/g,
matchToCmds: (rules, desc) => [{ matchToCmds: (rules, desc) => [{
type: "files", type: "files",
label: desc, label: desc,

View File

@ -90,6 +90,13 @@ const specialVars = {
match: /{{WindowInfo(.*?)}}/mg, match: /{{WindowInfo(.*?)}}/mg,
repl: jsonVar => handlingJsonVar(jsonVar, "WindowInfo") repl: jsonVar => handlingJsonVar(jsonVar, "WindowInfo")
}, },
MatchImage: {
name: "MatchImage",
label: "{{MatchImage}}",
desc: "匹配到图片的 DataUrl",
match: /{{MatchImage}}/mg,
repl: () => quickcommand.enterData.payload
},
SelectFile: { SelectFile: {
name: "SelectFile", name: "SelectFile",
label: "{{SelectFile}}", label: "{{SelectFile}}",

View File

@ -14,7 +14,7 @@ const routes = [{
import ('pages/NewCommand.vue') import ('pages/NewCommand.vue')
}, },
{ {
path: '/:type(default|files|key|regex|window|professional)_:uid(\\w+)', path: '/:type(default|files|img|key|regex|window|professional)_:uid(\\w+)',
component: () => component: () =>
import ('pages/CommandPage.vue') import ('pages/CommandPage.vue')
}, },