mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 14:34:13 +08:00
弃用jimp
This commit is contained in:
parent
5e2994fe6d
commit
7a79d3a443
@ -1,38 +0,0 @@
|
|||||||
const Jimp = require("jimp");
|
|
||||||
|
|
||||||
const imageProcessor = async (imagePath) => {
|
|
||||||
try {
|
|
||||||
// 读取图片
|
|
||||||
const image = await Jimp.read(imagePath);
|
|
||||||
|
|
||||||
// 获取原始尺寸
|
|
||||||
const originalWidth = image.getWidth();
|
|
||||||
const originalHeight = image.getHeight();
|
|
||||||
const ratio = originalWidth / originalHeight;
|
|
||||||
|
|
||||||
// 设置目标尺寸
|
|
||||||
let targetWidth = 1280;
|
|
||||||
let targetHeight = 720;
|
|
||||||
|
|
||||||
if (ratio > 16 / 9) {
|
|
||||||
targetHeight = Math.min(720, Math.round(targetWidth / ratio));
|
|
||||||
} else {
|
|
||||||
targetWidth = Math.min(1280, Math.round(targetHeight * ratio));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调整大小并压缩
|
|
||||||
await image
|
|
||||||
.resize(targetWidth, targetHeight, Jimp.RESIZE_BICUBIC)
|
|
||||||
.quality(80);
|
|
||||||
|
|
||||||
// 转换为 base64
|
|
||||||
const base64 = await image.getBase64Async(Jimp.MIME_JPEG);
|
|
||||||
|
|
||||||
return base64;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("处理图片失败:", error);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = imageProcessor;
|
|
@ -3,19 +3,17 @@ const path = require("path");
|
|||||||
const iconv = require("iconv-lite");
|
const iconv = require("iconv-lite");
|
||||||
const child_process = require("child_process");
|
const child_process = require("child_process");
|
||||||
|
|
||||||
const getBase64Ico = (filepath) => {
|
const resolveFileToBase64 = (filepath) => {
|
||||||
let sourceImage,
|
let imageBase64,
|
||||||
ext = path.extname(filepath).slice(1);
|
ext = path.extname(filepath).slice(1);
|
||||||
if (["png", "jpg", "jpeg", "bmp", "ico", "gif", "svg"].includes(ext)) {
|
if (["png", "jpg", "jpeg", "bmp", "ico", "gif", "svg"].includes(ext)) {
|
||||||
if (ext == "svg") ext = "svg+xml";
|
if (ext == "svg") ext = "svg+xml";
|
||||||
sourceImage =
|
imageBase64 =
|
||||||
`data:image/${ext};base64,` + fs.readFileSync(filepath, "base64");
|
`data:image/${ext};base64,` + fs.readFileSync(filepath, "base64");
|
||||||
if (ext == "png") return sourceImage;
|
|
||||||
} else {
|
} else {
|
||||||
sourceImage = window.utools.getFileIcon(filepath);
|
imageBase64 = window.utools.getFileIcon(filepath);
|
||||||
return sourceImage;
|
|
||||||
}
|
}
|
||||||
return sourceImage;
|
return imageBase64;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFileInfo = (options) => {
|
const getFileInfo = (options) => {
|
||||||
@ -98,7 +96,7 @@ const convertFilePathToUtoolsPayload = (files) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getBase64Ico,
|
resolveFileToBase64,
|
||||||
getFileInfo,
|
getFileInfo,
|
||||||
getCurrentFolderPathFix,
|
getCurrentFolderPathFix,
|
||||||
saveFile,
|
saveFile,
|
||||||
|
1661
plugin/package-lock.json
generated
1661
plugin/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,6 @@
|
|||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"iconv-lite": "^0.6.3",
|
"iconv-lite": "^0.6.3",
|
||||||
"jimp": "^0.22.12",
|
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"node-forge": "^1.3.1",
|
"node-forge": "^1.3.1",
|
||||||
"ses": "^1.10.0",
|
"ses": "^1.10.0",
|
||||||
|
@ -21,7 +21,7 @@ const getCommandToLaunchTerminal = require("./lib/getCommandToLaunchTerminal");
|
|||||||
const shortCodes = require("./lib/shortCodes");
|
const shortCodes = require("./lib/shortCodes");
|
||||||
const { pluginInfo, getUtoolsPlugins } = require("./lib/getUtoolsPlugins");
|
const { pluginInfo, getUtoolsPlugins } = require("./lib/getUtoolsPlugins");
|
||||||
const {
|
const {
|
||||||
getBase64Ico,
|
resolveFileToBase64,
|
||||||
getFileInfo,
|
getFileInfo,
|
||||||
getCurrentFolderPathFix,
|
getCurrentFolderPathFix,
|
||||||
saveFile,
|
saveFile,
|
||||||
@ -30,7 +30,7 @@ const {
|
|||||||
} = require("./lib/utils");
|
} = require("./lib/utils");
|
||||||
window.pluginInfo = pluginInfo;
|
window.pluginInfo = pluginInfo;
|
||||||
window.getUtoolsPlugins = getUtoolsPlugins;
|
window.getUtoolsPlugins = getUtoolsPlugins;
|
||||||
window.getBase64Ico = getBase64Ico;
|
window.resolveFileToBase64 = resolveFileToBase64;
|
||||||
window.getFileInfo = getFileInfo;
|
window.getFileInfo = getFileInfo;
|
||||||
window.getCurrentFolderPathFix = getCurrentFolderPathFix;
|
window.getCurrentFolderPathFix = getCurrentFolderPathFix;
|
||||||
window.saveFile = saveFile;
|
window.saveFile = saveFile;
|
||||||
@ -41,7 +41,6 @@ window.getuToolsLite = require("./lib/utoolsLite");
|
|||||||
window.quickcommand = require("./lib/quickcommand");
|
window.quickcommand = require("./lib/quickcommand");
|
||||||
window.quickcomposer = require("./lib/quickcomposer");
|
window.quickcomposer = require("./lib/quickcomposer");
|
||||||
window.getQuickcommandTempFile = require("./lib/getQuickcommandTempFile");
|
window.getQuickcommandTempFile = require("./lib/getQuickcommandTempFile");
|
||||||
window.imageProcessor = require("./lib/imageprocessor");
|
|
||||||
window.showUb = require("./lib/showDocs");
|
window.showUb = require("./lib/showDocs");
|
||||||
|
|
||||||
window.getSharedQcById = async (id) => {
|
window.getSharedQcById = async (id) => {
|
||||||
@ -98,7 +97,6 @@ window.removeHtmlTags = (value) => {
|
|||||||
return quickcommand.htmlParse(value).querySelector("body").innerText;
|
return quickcommand.htmlParse(value).querySelector("body").innerText;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
window.hexEncode = (text) => Buffer.from(text, "utf8").toString("hex");
|
window.hexEncode = (text) => Buffer.from(text, "utf8").toString("hex");
|
||||||
window.hexDecode = (text) => Buffer.from(text, "hex").toString("utf8");
|
window.hexDecode = (text) => Buffer.from(text, "hex").toString("utf8");
|
||||||
window.base64Decode = (text) => Buffer.from(text, "base64").toString("utf8");
|
window.base64Decode = (text) => Buffer.from(text, "base64").toString("utf8");
|
||||||
|
@ -145,6 +145,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import pictureCompress from "picture-compressor";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PersonalizeMenu",
|
name: "PersonalizeMenu",
|
||||||
@ -169,8 +170,9 @@ export default {
|
|||||||
const file =
|
const file =
|
||||||
mode === "light" ? this.selectFileLight : this.selectFileDark;
|
mode === "light" ? this.selectFileLight : this.selectFileDark;
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
const processedImage = await this.compressingPic(
|
||||||
const processedImage = await window.imageProcessor(file.path);
|
window.resolveFileToBase64(file.path)
|
||||||
|
);
|
||||||
|
|
||||||
if (mode === "light") {
|
if (mode === "light") {
|
||||||
this.$root.profile.backgroundImgLight = processedImage;
|
this.$root.profile.backgroundImgLight = processedImage;
|
||||||
@ -188,6 +190,16 @@ export default {
|
|||||||
this.$root.profile.glassEffect = val;
|
this.$root.profile.glassEffect = val;
|
||||||
this.$root.saveProfile();
|
this.$root.saveProfile();
|
||||||
},
|
},
|
||||||
|
async compressingPic(img) {
|
||||||
|
let compressedImage = await pictureCompress({
|
||||||
|
img: img,
|
||||||
|
width: 1280,
|
||||||
|
height: 720,
|
||||||
|
type: "jpg",
|
||||||
|
quality: 0.8,
|
||||||
|
});
|
||||||
|
return compressedImage.img;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -92,7 +92,8 @@ export default {
|
|||||||
options: ref(null),
|
options: ref(null),
|
||||||
loading: false,
|
loading: false,
|
||||||
icon8: {
|
icon8: {
|
||||||
platform: "office80,color,fluent,nolan,3d-fluency,isometric,emoji,dusk,stickers,plasticine,bubbles,cotton,clouds,doodle,arcade,pulsar-color,clr-gls,ultraviolet,flat_round,parakeet,neon,matisse,tiny-color,stencil,avantgarde,water-color,retro,3d-plastilina,stitch",
|
platform:
|
||||||
|
"office80,color,fluent,nolan,3d-fluency,isometric,emoji,dusk,stickers,plasticine,bubbles,cotton,clouds,doodle,arcade,pulsar-color,clr-gls,ultraviolet,flat_round,parakeet,neon,matisse,tiny-color,stencil,avantgarde,water-color,retro,3d-plastilina,stitch",
|
||||||
amount: "300",
|
amount: "300",
|
||||||
baseUrl: "https://search.icons8.com/api/iconsets/v5/search",
|
baseUrl: "https://search.icons8.com/api/iconsets/v5/search",
|
||||||
},
|
},
|
||||||
@ -158,7 +159,7 @@ export default {
|
|||||||
this.localIconFile.slice(-4) === ".exe"
|
this.localIconFile.slice(-4) === ".exe"
|
||||||
)
|
)
|
||||||
return this.setIcon(utools.getFileIcon(this.localIconFile));
|
return this.setIcon(utools.getFileIcon(this.localIconFile));
|
||||||
this.compressingPic(window.getBase64Ico(this.localIconFile)).then(
|
this.compressingPic(window.resolveFileToBase64(this.localIconFile)).then(
|
||||||
(dataUrl) => {
|
(dataUrl) => {
|
||||||
dataUrl && this.setIcon(dataUrl);
|
dataUrl && this.setIcon(dataUrl);
|
||||||
}
|
}
|
||||||
@ -177,13 +178,15 @@ export default {
|
|||||||
argvs: imgUrl,
|
argvs: imgUrl,
|
||||||
readfile: false,
|
readfile: false,
|
||||||
});
|
});
|
||||||
let imgPath = window.getQuickcommandTempFile(imgInfo.ext, 'TempImgFile');
|
let imgPath = window.getQuickcommandTempFile(imgInfo.ext, "TempImgFile");
|
||||||
quickcommand
|
quickcommand
|
||||||
.downloadFile(imgUrl, imgPath)
|
.downloadFile(imgUrl, imgPath)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.compressingPic(window.getBase64Ico(imgPath)).then((src) => {
|
this.compressingPic(window.resolveFileToBase64(imgPath)).then(
|
||||||
|
(src) => {
|
||||||
callback(src);
|
callback(src);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
quickcommand.showMessageBox("图片地址有误!", "error");
|
quickcommand.showMessageBox("图片地址有误!", "error");
|
||||||
|
@ -51,7 +51,7 @@ export default {
|
|||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
let res = await quickcommand.downloadFile(iconUrl, iconPath);
|
let res = await quickcommand.downloadFile(iconUrl, iconPath);
|
||||||
if (res) command.features.icon = window.getBase64Ico(iconPath);
|
if (res) command.features.icon = window.resolveFileToBase64(iconPath);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
this.importCommand(command);
|
this.importCommand(command);
|
||||||
utools.showNotification("操作成功!");
|
utools.showNotification("操作成功!");
|
||||||
|
@ -120,7 +120,7 @@ export default {
|
|||||||
features: {
|
features: {
|
||||||
cmds: this.nickName,
|
cmds: this.nickName,
|
||||||
explain: this.feature.explain,
|
explain: this.feature.explain,
|
||||||
icon: window.getBase64Ico(this.plugin.logoPath),
|
icon: window.resolveFileToBase64(this.plugin.logoPath),
|
||||||
platform: this.plugin.platform || ["darwin", "win32", "linux"],
|
platform: this.plugin.platform || ["darwin", "win32", "linux"],
|
||||||
code: `key_${uid}`,
|
code: `key_${uid}`,
|
||||||
},
|
},
|
||||||
|
@ -2,51 +2,44 @@
|
|||||||
* 所有的匹配类型
|
* 所有的匹配类型
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const jsonSample = [
|
const jsonSample = [
|
||||||
"关键词",
|
"关键词",
|
||||||
{
|
{
|
||||||
"type": "img",
|
type: "img",
|
||||||
"label": "图片匹配"
|
label: "图片匹配",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "files",
|
type: "files",
|
||||||
"label": "文件匹配",
|
label: "文件匹配",
|
||||||
"fileType": "file",
|
fileType: "file",
|
||||||
"match": "/aaa/",
|
match: "/aaa/",
|
||||||
"minLength": 1,
|
minLength: 1,
|
||||||
"maxLength": 99
|
maxLength: 99,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "regex",
|
type: "regex",
|
||||||
"label": "文本正则匹配",
|
label: "文本正则匹配",
|
||||||
"match": "/bbb/i",
|
match: "/bbb/i",
|
||||||
"minLength": 1,
|
minLength: 1,
|
||||||
"maxLength": 99
|
maxLength: 99,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "over",
|
type: "over",
|
||||||
"label": "无匹配时",
|
label: "无匹配时",
|
||||||
"exclude": "/ccc/i",
|
exclude: "/ccc/i",
|
||||||
"minLength": 1,
|
minLength: 1,
|
||||||
"maxLength": 99
|
maxLength: 99,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "window",
|
type: "window",
|
||||||
"label": "窗口动作",
|
label: "窗口动作",
|
||||||
"match": {
|
match: {
|
||||||
"app": [
|
app: ["ddd.app", "eee.exe"],
|
||||||
"ddd.app",
|
title: "/fff/",
|
||||||
"eee.exe"
|
class: ["ggg"],
|
||||||
],
|
},
|
||||||
"title": "/fff/",
|
},
|
||||||
"class": [
|
];
|
||||||
"ggg"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const commandTypes = {
|
const commandTypes = {
|
||||||
key: {
|
key: {
|
||||||
@ -57,7 +50,8 @@ const commandTypes = {
|
|||||||
matchLabel: "关键词",
|
matchLabel: "关键词",
|
||||||
desc: "直接在主输入框输入对应关键字,最通用的一种模式,关键字可以设置多个",
|
desc: "直接在主输入框输入对应关键字,最通用的一种模式,关键字可以设置多个",
|
||||||
valueType: "array",
|
valueType: "array",
|
||||||
disabledSpecialVars: /{{input}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}|{{MatchedFiles.*?}}/g,
|
disabledSpecialVars:
|
||||||
|
/{{input}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}|{{MatchedFiles.*?}}/g,
|
||||||
matchToCmds: (rules, desc) => rules,
|
matchToCmds: (rules, desc) => rules,
|
||||||
verify: (rules) => !_.isEmpty(rules) || "关键词不能为空",
|
verify: (rules) => !_.isEmpty(rules) || "关键词不能为空",
|
||||||
},
|
},
|
||||||
@ -69,18 +63,21 @@ const commandTypes = {
|
|||||||
matchLabel: "正则",
|
matchLabel: "正则",
|
||||||
desc: "匹配主输入框或超级面板选中的文本,可以获取输入框文本或选中文本作为变量",
|
desc: "匹配主输入框或超级面板选中的文本,可以获取输入框文本或选中文本作为变量",
|
||||||
valueType: "regex",
|
valueType: "regex",
|
||||||
disabledSpecialVars: /{{SelectFile}}|{{MatchImage}}|{{WindowInfo.*?}}|{{pwd}}|{{MatchedFiles.*?}}/g,
|
disabledSpecialVars:
|
||||||
matchToCmds: (rules, desc) => [{
|
/{{SelectFile}}|{{MatchImage}}|{{WindowInfo.*?}}|{{pwd}}|{{MatchedFiles.*?}}/g,
|
||||||
|
matchToCmds: (rules, desc) => [
|
||||||
|
{
|
||||||
label: desc,
|
label: desc,
|
||||||
type: "regex",
|
type: "regex",
|
||||||
match: rules,
|
match: rules,
|
||||||
minNum: 1,
|
minNum: 1,
|
||||||
}, ],
|
},
|
||||||
verify: rules => !!rules > 0 || "正则不能为空",
|
],
|
||||||
|
verify: (rules) => !!rules > 0 || "正则不能为空",
|
||||||
tempPayload: async () => {
|
tempPayload: async () => {
|
||||||
let values = await quickcommand.showInputBox(["需要处理的文本"])
|
let values = await quickcommand.showInputBox(["需要处理的文本"]);
|
||||||
return values[0]
|
return values[0];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
over: {
|
over: {
|
||||||
name: "over",
|
name: "over",
|
||||||
@ -90,17 +87,20 @@ const commandTypes = {
|
|||||||
color: "light-green",
|
color: "light-green",
|
||||||
desc: "匹配主输入框的所有文本,但只有在该文本未设置对应的插件或功能时才生效",
|
desc: "匹配主输入框的所有文本,但只有在该文本未设置对应的插件或功能时才生效",
|
||||||
valueType: null,
|
valueType: null,
|
||||||
disabledSpecialVars: /{{SelectFile}}|{{MatchImage}}|{{WindowInfo.*?}}|{{pwd}}|{{MatchedFiles.*?}}/g,
|
disabledSpecialVars:
|
||||||
matchToCmds: (rules, desc) => [{
|
/{{SelectFile}}|{{MatchImage}}|{{WindowInfo.*?}}|{{pwd}}|{{MatchedFiles.*?}}/g,
|
||||||
|
matchToCmds: (rules, desc) => [
|
||||||
|
{
|
||||||
label: desc,
|
label: desc,
|
||||||
type: "over",
|
type: "over",
|
||||||
minNum: 1,
|
minNum: 1,
|
||||||
}],
|
},
|
||||||
verify: rules => true,
|
],
|
||||||
|
verify: (rules) => true,
|
||||||
tempPayload: async () => {
|
tempPayload: async () => {
|
||||||
let values = await quickcommand.showInputBox(["需要处理的文本"])
|
let values = await quickcommand.showInputBox(["需要处理的文本"]);
|
||||||
return values[0]
|
return values[0];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
window: {
|
window: {
|
||||||
name: "window",
|
name: "window",
|
||||||
@ -111,14 +111,16 @@ const commandTypes = {
|
|||||||
desc: "匹配呼出uTools前或唤出超级面板时的活动窗口,可以获取窗口的信息或文件夹路径作为变量",
|
desc: "匹配呼出uTools前或唤出超级面板时的活动窗口,可以获取窗口的信息或文件夹路径作为变量",
|
||||||
valueType: "array",
|
valueType: "array",
|
||||||
disabledSpecialVars: /{{input}}|{{MatchImage}}|{{MatchedFiles.*?}}/g,
|
disabledSpecialVars: /{{input}}|{{MatchImage}}|{{MatchedFiles.*?}}/g,
|
||||||
matchToCmds: (rules, desc) => [{
|
matchToCmds: (rules, desc) => [
|
||||||
|
{
|
||||||
type: "window",
|
type: "window",
|
||||||
label: desc,
|
label: desc,
|
||||||
match: {
|
match: {
|
||||||
"app": rules
|
app: rules,
|
||||||
}
|
},
|
||||||
}],
|
},
|
||||||
verify: rules => !_.isEmpty(rules) || "进程名不能为空",
|
],
|
||||||
|
verify: (rules) => !_.isEmpty(rules) || "进程名不能为空",
|
||||||
},
|
},
|
||||||
img: {
|
img: {
|
||||||
name: "img",
|
name: "img",
|
||||||
@ -128,24 +130,27 @@ const commandTypes = {
|
|||||||
color: "deep-orange",
|
color: "deep-orange",
|
||||||
desc: "匹配剪贴板的图片,并返回图片的 DataUrl",
|
desc: "匹配剪贴板的图片,并返回图片的 DataUrl",
|
||||||
valueType: null,
|
valueType: null,
|
||||||
disabledSpecialVars: /{{input}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}|{{MatchedFiles.*?}}/g,
|
disabledSpecialVars:
|
||||||
matchToCmds: (rules, desc) => [{
|
/{{input}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}|{{MatchedFiles.*?}}/g,
|
||||||
|
matchToCmds: (rules, desc) => [
|
||||||
|
{
|
||||||
label: desc,
|
label: desc,
|
||||||
type: "img",
|
type: "img",
|
||||||
}],
|
},
|
||||||
verify: rules => true,
|
],
|
||||||
tempPayload: () => window.getBase64Ico(utools.showOpenDialog({
|
verify: (rules) => true,
|
||||||
|
tempPayload: () =>
|
||||||
|
window.resolveFileToBase64(
|
||||||
|
utools.showOpenDialog({
|
||||||
title: "需要处理的图片",
|
title: "需要处理的图片",
|
||||||
filters: [{
|
filters: [
|
||||||
name: 'Images',
|
{
|
||||||
extensions: ['png',
|
name: "Images",
|
||||||
'jpg',
|
extensions: ["png", "jpg", "jpeg", "bmp", "gif"],
|
||||||
'jpeg',
|
},
|
||||||
'bmp',
|
],
|
||||||
'gif',
|
})[0]
|
||||||
]
|
),
|
||||||
}]
|
|
||||||
})[0])
|
|
||||||
},
|
},
|
||||||
files: {
|
files: {
|
||||||
name: "files",
|
name: "files",
|
||||||
@ -155,20 +160,25 @@ const commandTypes = {
|
|||||||
color: "light-blue",
|
color: "light-blue",
|
||||||
desc: "匹配主输入框或超级面板选中的文件,可以获取复制及选中的文件信息作为变量",
|
desc: "匹配主输入框或超级面板选中的文件,可以获取复制及选中的文件信息作为变量",
|
||||||
valueType: "regex",
|
valueType: "regex",
|
||||||
disabledSpecialVars: /{{input}}|{{MatchImage}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}/g,
|
disabledSpecialVars:
|
||||||
matchToCmds: (rules, desc) => [{
|
/{{input}}|{{MatchImage}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}/g,
|
||||||
|
matchToCmds: (rules, desc) => [
|
||||||
|
{
|
||||||
type: "files",
|
type: "files",
|
||||||
label: desc,
|
label: desc,
|
||||||
match: rules.match,
|
match: rules.match,
|
||||||
fileType: rules.fileType,
|
fileType: rules.fileType,
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
}, ],
|
},
|
||||||
verify: rules => !!rules > 0 || "正则不能为空",
|
],
|
||||||
tempPayload: () => window.convertFilePathToUtoolsPayload(utools.showOpenDialog({
|
verify: (rules) => !!rules > 0 || "正则不能为空",
|
||||||
|
tempPayload: () =>
|
||||||
|
window.convertFilePathToUtoolsPayload(
|
||||||
|
utools.showOpenDialog({
|
||||||
title: "需要处理的文件",
|
title: "需要处理的文件",
|
||||||
properties: ['openFile', 'multiSelections']
|
properties: ["openFile", "multiSelections"],
|
||||||
}))
|
})
|
||||||
|
),
|
||||||
},
|
},
|
||||||
professional: {
|
professional: {
|
||||||
name: "professional",
|
name: "professional",
|
||||||
@ -179,16 +189,16 @@ const commandTypes = {
|
|||||||
valueType: "json",
|
valueType: "json",
|
||||||
disabledSpecialVars: null,
|
disabledSpecialVars: null,
|
||||||
matchToCmds: (rules, desc) => JSON.parse(rules),
|
matchToCmds: (rules, desc) => JSON.parse(rules),
|
||||||
verify: rules => {
|
verify: (rules) => {
|
||||||
try {
|
try {
|
||||||
JSON.parse(rules);
|
JSON.parse(rules);
|
||||||
return true
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return "专业模式json配置错误"
|
return "专业模式json配置错误";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jsonSample: jsonSample
|
jsonSample: jsonSample,
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export default commandTypes
|
export default commandTypes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user