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

Add support of link labels #687

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mokaddem
Copy link

@mokaddem mokaddem commented May 3, 2023

Hello!

First of all, many thanks for all the effort spent on creating this awesome project!

I had to introduce the support of link labels and I felt like it would benefit the community to have this feature as well.
Right now, each labels are created using HTML defined by the app, but we could think of a way to parametrize this part if you think the effort is worth it.

Here is how you could use it

const editor = new Drawflow(el)

// Define some labels in HTML
const label1 = '<span class="label label-info" id="lb-a">Label A</span>'
const label2 = '<span class="label label-warning" id="lb-b">Label B</span>'
const labels = [label1, label2]

// Labels will be automatically added if they exist
editor.addConnection(id_output, id_input, output_class, input_class, labels)

And here's what it looks like
image

Let me know if you see issues or if you'd like me to change something.
Cheers!

Enable the display of labels (passed by HTML) in the middle of a link.
@jerosoler
Copy link
Owner

Hello! @mokaddem

Thanks for PR.

If labels is one thing missing.

There are alternatives to add the labels:

@mokaddem mokaddem mentioned this pull request Jul 28, 2023
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.

None yet

2 participants