Skip to content

Added the ability to set the contents of a node as an element#932

Open
n2ref wants to merge 2 commits intojerosoler:masterfrom
n2ref:master
Open

Added the ability to set the contents of a node as an element#932
n2ref wants to merge 2 commits intojerosoler:masterfrom
n2ref:master

Conversation

@n2ref
Copy link

@n2ref n2ref commented May 4, 2025

No description provided.

@jerosoler
Copy link
Owner

It wouldn't be the same as:

https://github.com/jerosoler/Drawflow?tab=readme-ov-file#register-node

When exporting/importing it is better not to use an HTML node.

@n2ref
Copy link
Author

n2ref commented May 4, 2025

How then can I add a node as an HTMLElement using the addNode method? The current form only has the html parameter available. Or when registering a node, but it is cloned, which is not suitable for me.

image

@jerosoler
Copy link
Owner

jerosoler commented May 4, 2025

HTMLElement

is simple?

editor.addNode('github', 0, 1, 150, 300, 'github', data, '<div>Hello!<br>World<div>');

what are you trying to add?

@n2ref
Copy link
Author

n2ref commented May 4, 2025

I add there an HTMLElement object, which was created by another library, which has its own events and logic. For correct work it should be accessible by reference. But as soon as cloning occurs, there is no such access.

@jerosoler
Copy link
Owner

In that case, you might have to use that method.

There's probably another way, but if it works for you, go for it!

@n2ref
Copy link
Author

n2ref commented May 4, 2025

Unfortunately, it seems that not everything is so simple. When importing, the method breaks. I'll think about how to get around this.

image

image

@n2ref
Copy link
Author

n2ref commented May 4, 2025

It seems like everything works fine without it. Why is it necessary?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants