support custom icons

This commit is contained in:
codetypes committed 2024-04-17 13:29:10 +08:00
1 parent 1c0ac119f4
commit b81d9449c9
8 files changed
+16 -6

No files matched your search

+4
View File
@@ -32,6 +32,9 @@ if (!app.requestSingleInstanceLock()) {
process.exit(0);
}
app.commandLine.appendArgument("–-allow-file-access-from-files");
app.commandLine.appendArgument("--disable-web-security");
// Remove electron security warnings
// This warning only shows in development mode
// Read more on https://www.electronjs.org/docs/latest/tutorial/security
@@ -73,6 +76,7 @@ async function createWindow(projectPath?: string) {
// Read more on https://www.electronjs.org/docs/latest/tutorial/context-isolation
nodeIntegration: true,
contextIsolation: false,
webSecurity: false,
},
});
+1 -1
View File
@@ -78,7 +78,7 @@
"node.deleteRootNodeDenied": "Unable to delete the root node",
"node.editSubtreeDenied": "Unable to edit the subtree node",
"node.desc": "Node desc",
"node.fileRequired": "{{field}} field is required",
"node.fileRequired": "field '{{field}}' is required",
"node.id": "Node id",
"node.inputVariable": "Input variables",
"node.name": "Node name",
+1 -1
View File
@@ -78,7 +78,7 @@
"node.deleteRootNodeDenied": "不能删除根节点",
"node.editSubtreeDenied": "不能编辑子树节点",
"node.desc": "节点说明",
"node.fileRequired": "字段<b>{{field}}</b>必填",
"node.fileRequired": "字段“{{field}}”必填",
"node.id": "节点标识",
"node.inputVariable": "输入变量",
"node.name": "节点名称",
+6
View File
@@ -0,0 +1,6 @@
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" height="200px" width="200px"
xmlns="http://www.w3.org/2000/svg">
<path
d="M6.01 2c-1.93 0-3.5 1.57-3.5 3.5 0 1.58 1.06 2.903 2.5 3.337v7.16c-.001.179.027 1.781 1.174 2.931C6.892 19.64 7.84 20 9 20v2l4-3-4-3v2c-1.823 0-1.984-1.534-1.99-2V8.837c1.44-.434 2.5-1.757 2.5-3.337 0-1.93-1.571-3.5-3.5-3.5zm0 5c-.827 0-1.5-.673-1.5-1.5S5.183 4 6.01 4s1.5.673 1.5 1.5S6.837 7 6.01 7zm13 8.163V7.997C19.005 6.391 17.933 4 15 4V2l-4 3 4 3V6c1.829 0 2.001 1.539 2.01 2v7.163c-1.44.434-2.5 1.757-2.5 3.337 0 1.93 1.57 3.5 3.5 3.5s3.5-1.57 3.5-3.5c0-1.58-1.06-2.903-2.5-3.337zm-1 4.837c-.827 0-1.5-.673-1.5-1.5s.673-1.5 1.5-1.5 1.5.673 1.5 1.5-.673 1.5-1.5 1.5z">
</path>
</svg>

After

Width:  |  Height:  |  Size: 768 B

+1
View File
@@ -22,6 +22,7 @@
{
"name": "Cmp",
"type": "Condition",
"icon": "icons/cmp.svg",
"doc": "+ 若值为空,返回失败\n+ 非整数类型可能会报错\n",
"input": [
"值(int)"
+2 -2
View File
@@ -68,13 +68,13 @@ export const Inspector: FC = () => {
if (node) {
node.input?.forEach((v, i) => {
const desc = node.def.input?.[i] ?? "<unknown>";
if (v && !options.find((option) => option.value !== v)) {
if (v && !options.find((option) => option.value === v)) {
options.push({ label: `${v}(${desc})`, value: v });
}
});
node.output?.forEach((v, i) => {
const desc = node.def.output?.[i] ?? "<unknown>";
if (v && !options.find((option) => option.value !== v)) {
if (v && !options.find((option) => option.value === v)) {
options.push({ label: `${v}(${desc})`, value: v });
}
});
+1 -1
View File
@@ -174,7 +174,7 @@ G6.registerNode(
});
// icon
const img = `./icons/${classify}.svg`;
const img = nodeDef.icon ? workspace.workdir + "/" + nodeDef.icon : `./icons/${classify}.svg`;
addShape("image", {
attrs: {
x: 5,
-1
View File
@@ -381,7 +381,6 @@ export const useWorkspace = create<WorkspaceStore>((set, get) => ({
const workspace = get();
let hasEvent = false;
fs.watch(workspace.workdir, { recursive: true }, (event, filename) => {
console.log("fileanme", event, filename);
if (event === "rename") {
if (!hasEvent) {
setTimeout(() => {