Info content preview button

Hi There,

So doing documentation in Node-RED is super simple since there is the info panel and the info property of nodes and tabs and it's all in markdown - wonderful however ....

What annoys me is that to preview my changes, I need to save my changes, close the panel open the info panel (if its not open already).

What I'd like to have instead is a preview button (ideally an automatic preview like here in the forum would be best):

preview-feature

That screen shot is take from my Erlang-Red editor and the changes are in this commit.

I only made the change for the tab info contents (not nodes) and it's very rough and ready. But it also has the advantage that I can preview changes but when I do cancel, those changes aren't saved - I'm creating a duplicate node and using that to update the sidebar:

let tabNode = RED.nodes.createExportableNodeSet([RED.nodes.workspace(RED.workspaces.active())])[0];
tabNode.info = window.currentTabflowEditor.getValue();
RED.sidebar.info.refresh(tabNode);

I don't know how relevant this would be for editing documentation for nodes, I tend to only document the entire flow, i.e., tab i.e., workspace.

1 Like

I see the benefit and am in favor.
I can edit cleanly this FR (so open a PR) if the team agrees.

2 Likes

I also just improved the solution by using the node context instead of the window :slight_smile:

But ideally there would be a much better solution than cloning nodes all over the place.

I was going to use the setInfoText function but that isn't exported, so it had to be the refresh() function.

You can already do this.

  1. Click the expand button

  1. Click the preview button

  1. Marvel at the preview

3 Likes

that is indeed very cool especially since the sidebar is still active.

It's a 4.x thing right? Didn't find it in my 3.1.x installation.

According to the change history, the preview button for the markdown editor has been there since 0.20.0 - 7 years ago.

1 Like

Mea culpa, my eyes are going - on second looks, it's there in 3.1.x - sorry for the confusion!

@knolleary If you do that expand then it is easy for the preview button to get hidden behind the bar on the right... so much so I missed it completely :wink:

Glad I wasn't the only one! I don't feel quite as much a dufus now. :blush: