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

+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(() => {