GGEditor icon indicating copy to clipboard operation
GGEditor copied to clipboard

[Question] How to create custom nodes for the Flow component?

Open jahirfiquitiva opened this issue 6 years ago • 7 comments

Hello

I am wondering if there's a way to create custom nodes, where, besides all the existent properties for each node, I could include some extra custom ones, for custom purposes. Let's say I want a node to include a Date and Age properties, or something.

Is it possible? If so, how can I achieve that? I checked the docs but couldn't find anything specifically related to that.

Thanks in advance.

jahirfiquitiva avatar Feb 18 '19 20:02 jahirfiquitiva

This is a demo of registering custom nodes :)

https://codesandbox.io/s/4j62moqy0w

gaoli avatar Feb 20 '19 04:02 gaoli

@gaoli Thanks a lot for the help, but I still don't know how to set custom properties For example, a Date variable and an int one, let's say for the createdAt and age properties, respectively. would you mind helping me with that? Thanks again

jahirfiquitiva avatar Feb 20 '19 04:02 jahirfiquitiva

@jahirfiquitiva Have you had any luck with this? I just want to add a custom userData field which holds another json. @gaoli any suggestions on how to accomplish this?

karanrajpal14 avatar Apr 17 '19 10:04 karanrajpal14

@jahirfiquitiva @karanrajpal14

You can refer to this demo :)

gaoli avatar Apr 19 '19 02:04 gaoli

Hello @gaoli,

This definitely does help. Thank you!

Is there a way to do this by defining a custom node as well? For example, just like what you've done with the icon, is it possible to define custom properties for every node named custom-node by extending the model? I've been trying to do that but I've been unsuccessful so far, sadly.

karanrajpal14 avatar Apr 19 '19 04:04 karanrajpal14

@gaoli 请问大佬 对上面 @ karanrajpal14说的 custom-node通过扩展模型为每个命名节点定义自定义属性 有demo吗?我这边也不会呐 求指教

keepwe avatar Jun 13 '20 09:06 keepwe

@gaoli this demo is for version 2.0, with latest one it's broken. Could you provide updated demo?

VanDavv avatar Jun 23 '20 08:06 VanDavv