jerosoler / Drawflow

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

Editing node HTML without reloading the page #268

Closed adamburczy closed 3 years ago

adamburczy commented 3 years ago

Every time I edit node HTML like that: editor.drawflow.drawflow.Home.data[id].html = "..." I need to reload the page to see new HTML. Is there a way to edit HTML without need to reload the page?

jerosoler commented 3 years ago

Hi

You only pass data to export, not in editor.

View example in https://github.com/jerosoler/Drawflow/issues/252

Other option is export data an import now.

Orgix commented 3 years ago

Hey,

I don't know your project structure, but what worked for me is to target the node like this:

let elem = document.getElementById("node-"+id)

I basically do

elem.innerHTML = "..." 
editor.drawflow.drawflow.Home.data[id].html = "..."

That way you get live changes, even though you are manipulating DOM and you get to save the changes for possible export. At least this works for vanilla JS approach.

Hope it helps.