Custom function node with auto filled code

#1

Can i create a custom function node with auto filled code in it ? How do i achieve this?

I would like to drag-drop this custom node, and when i double click, the code(which is pre-configured or pre-defined) has to appear in the Code section

0 Likes

#2

you could define a subflow containing just the function node you require ?
or maybe worth looking at the nodegen project - https://github.com/node-red/node-red-nodegen that can create a custom node from a function node.

1 Like

#3

Yes, I would say this is possible. Not necessarily easy but certainly possible.

If you check out the v2 branch of uibuilder, you will find that I've implemented a full editor there. That loads code from files into the editor just by selecting from a drop-down. You can then change the code and save it back to file.

So all the basics are there in that node.

I assume though, that you want to do something slightly different. uibuilder edits code for use in a client browser, I'm guessing you want the code to run in Node-RED? So you would need to take your clues from the core function node.

0 Likes

#4

Thanks, will check this

0 Likes