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

An exception occurs when node data key has ',' or '|' and some areas cannot be dragged #336

Closed
rni-l opened this issue Dec 30, 2021 · 8 comments
Assignees

Comments

@rni-l
Copy link

rni-l commented Dec 30, 2021

Hi, I have two questions.

Version: 0.0.54.

First:

An exception occurs when the node data key has ',' or '|'.

code:

editor.import(drawflow: {
          Home: {
            data: {
              1: {
                id: 1,
                name: "welcome",
                data: {
                  test: {
                    "aaa,a": "1",
                    "aaa|a": "1",
                  },
                },
                class: "welcome",
                html: '<div>test</div>',
                typenode: false,
                inputs: {},
                outputs: {},
                pos_x: 50,
                pos_y: 50,
              },
            },
          },
        },)

Second:

If the root dom has class, the outside of '.drawflow' cannot be dragged.

I think it was caused by here:

image

In this demo, it will be reproduced.

@jerosoler
Copy link
Owner

Hi @rni-l

Thanks for issue and PR.

I see you are using vue.

Not only those characters are not allowed. If not many others too.

Affects all characters in html attributes. https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
For example: "@#$...."

That for example students could conflict with vue ":", "@"
https://vuejs.org/v2/guide/syntax.html#Shorthands

We would have to get all the allowed characters and not just two.

For example chrome not support or show error:
image

The attribute df they are used to synchronize directly with the data. If it is badly formed or the browser does not support it, it could cause errors or problems. I think it is better not to allow strange characters.
image

Jero

@jerosoler jerosoler self-assigned this Dec 30, 2021
@rni-l
Copy link
Author

rni-l commented Dec 31, 2021

Thanks @jerosoler

But I need to save complex data in each node, it includes ',' and '|' characters, so do you have other ways to solve this problem? Can I only use an additional object to store the node data?

@jerosoler
Copy link
Owner

If you are not going to use the df attributes, you can use:
#97

If you can't convert the data before "import" and after "export".

@rni-l
Copy link
Author

rni-l commented Jan 3, 2022

Thanks @jerosoler

I solved the first question.

@jerosoler
Copy link
Owner

Can you elaborate on the second question?

@rni-l
Copy link
Author

rni-l commented Jan 3, 2022

You can go to look at this demo.

The blue area is the root node and the red area is the '.drawflow' node. When I added the class to the root node, I can't drag the blue area, only the red area.

// HTML
<div class="box"></div>

// js
editor= new Drawflow(document.querySelector(".box"));

I think it was caused by here:

Forgive my bad English...

@jerosoler
Copy link
Owner

It is an issue that is currently open. #141

Change:

<div class="box"></div>

For:

<div class="parent-drawflow box"></div>

@rni-l
Copy link
Author

rni-l commented Jan 3, 2022

Thanks.

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

No branches or pull requests

2 participants