jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.65k stars 722 forks source link

Add tooltips in Output connections and store them #515

Open Yslachy opened 2 years ago

Yslachy commented 2 years ago

Hello Jerosoler,

Thank you for your great library !

I have a project where I need to restrict the connections allowed between nodes. To help the future user of the app, I added tooltips displaying the connections allowed for each node's output. image

The problem is that I have also two submodules in my project and each time a module is changed, all dynamics changes added after node creation are lost.

To save dynamic node content add in a node (class: drawflow_content_node), I have created this function that works: image

But I don't know how to save the input/output changes and more generally the entire representation of the node for future imports/exports (for exemple "node-1" and all this content in the following screenchot) ? image

I hope my question is clear. Thank you !

jerosoler commented 2 years ago

I could save the data like this for example.

editor_ext.drawflow.drawflow[module].data[node_id].outputInfo = /* Your info */

And use event import to load changes. With addConnectionTooltip looping through the json

Yslachy commented 2 years ago

Ok thank you, I'll try that.

But do you have some built-in method to automatically save all dynamics changes (export the raw content into the div "node-id") ? This would be really useful to make a clean export and avoid forgetting some applied changes.

jerosoler commented 2 years ago

Hello,

There is no method.

But I could do it in the export and take the innerHTML of each node.

The html field is intended as a template, not as the modified html code.