Custom function node with auto filled code

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

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

1 Like

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.

Thanks, will check this