Closed mcesaro closed 2 years ago
Why don't you use the editor.import
method?
Try raising the settimeout to a higher time. 250-500 ...
Hi Jero,
I replaced editor.load()
with editor.import(df)
but the result is the same, i.e. connections aren't displayed correctly.
A higher timeout works better, however it creates a noticeable delay/flicker.
Still I'm wondering why with the blocking prompt this won't happen...
Thank you for you support.
It may be that the prompt is modifying some css. It's the only thing I can think of. If you want to prepare a codepen or a codesandbox and we will look at it.
I was able to determine that the problem lies in an interaction with https://sweetalert2.github.io/ I replaced this library with an equivalent for modal dialog (nor using the async functions like SWAL2), and the problem disappears.
Oh excellent!
Hi @jerosoler , thank you again for your great tool. I'm using Drawflow for an application that allows the storage of flows on a server with standard REST API. In my initial version, I ask the name of the flow to load using the
Window.prompt()
method and I use the returned name to fetch the document from server, then load the flow like this:and all works well. Replacing
Window.prompt()
with SWAL (Sweet Alert2) requires the use of an async function:If I fetch the flow from the server in this way:
Then the flow loads correctly but the connections aren't. Connections appear as horizontal lines on top of the flow. I tried to call a refresh connection function like this:
but this only works if it's invoked after some timeout, like this:
This clumsy workaround works most of times. Not always, though. Note that using
Window.prompt()
the connections are always good. Note also that manually forcing a redraw, like changing current module, also draws the connections correctly, without the need of theeditor.updateConnectionNodes()
method.I'm probably doing something wrong because I'm still learning Javascript, but I can't see what. Can you point me in the right direction?
Thanks Massimo