Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit node? #52

Closed
samdoeswork opened this issue Oct 23, 2020 · 3 comments
Closed

Edit node? #52

samdoeswork opened this issue Oct 23, 2020 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@samdoeswork
Copy link

Hi,
First off Drawflow is brilliant, thank you!

I couldn't see any method to actually update the content of an existing node, e.g. to change the layout in the template. Failing this, perhaps a redraw method which doesn't clear the IDs?

The use-case is to have my application change content, e.g. the title or icon or other HTML content, then display this change to the user.

Thanks!
Sam

@jerosoler jerosoler self-assigned this Oct 24, 2020
@jerosoler jerosoler added the question Further information is requested label Oct 24, 2020
@jerosoler
Copy link
Owner

Hello

Thanks!

There is currently no method. Maybe in the future.
Since when updating the html content, the data values would also have to be updated.

You can also update the html as mentioned in: #40

You will probably also need: #43

@samdoeswork
Copy link
Author

samdoeswork commented Oct 25, 2020 via email

@kokmok
Copy link

kokmok commented Nov 16, 2022

It's been a long time this issue is closed but facing the same issue I managed a workaround that looks a lot simpler to me.
You can do this with pure JS since the node is simply a div.

What I made from an angular app is something like this (simplified):

@ViewChild('editor')
editorElementRef: ElementRef;

updateNodeHtml(nodeId: number, content: string): void {
        const nodeContainer = this.editorElementRef.nativeElement.querySelector('#node-' + nodeId + ' .drawflow_content_node');
        nodeContainer.innerHTML = content;
}

// ....
this.updateNodeHtml(1, '<h1>MyNewNodeContent</h1>');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants