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

Intercepting Drag&Drop event #1051

Open
Ugurercin opened this issue Feb 16, 2024 · 0 comments
Open

Intercepting Drag&Drop event #1051

Ugurercin opened this issue Feb 16, 2024 · 0 comments
Labels

Comments

@Ugurercin
Copy link

Ugurercin commented Feb 16, 2024

Currently working on formio with angular 17. What I'm trying to achieve is that, make sure that I have some sort of a drag-drop validation.

For example; If a user happen to start dragging, lets stay, a 'Panel' component and drop it into another 'Panel' component, I would like to intercept it and not allow to user to do that action.
As far as I conclude that, formio is using dragula for managing drag and drop futures.

I have the following HTML side:
image

Options is currently empty and default.

On top of this, I went through the event object and manage to find dragula.
image

And the dragula instance is as follows;
image

First question is, is it possible to intercept and intervene the behavior of drag and drop in such way ? If yes, how may I achieve this goal.

Example:
Following screenshot has 2 panel components. As the 2nd panel component dropped in the first component, I would like to get the event(addComponent) and check if the parent component is a panel component as well, if yes, I would like to prevent the user to perform this addComponent event and revert it.

image

Any help would be appreciated, thank you in advance.

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

No branches or pull requests

1 participant