Issue #2744Opened April 28, 2020by jcze910 reactions

[QUESTION] Disable a block drag&drop

Question

Hello everyone,

I would like to make forbidden the drop of one block before another specific one. Context : i've create a new trait for some blocks to set them as "page header", and I don't want to allow the drag&drop one block before this "page header" as it must be the first block of my template.

I saw I could listen sorter:drag:validation event and update the valid property to false in this perspective. But I can't known the future order of the block I would drop.

So, I would be glad to know one solution to this problem.

Thanks in advance :)

Answers (3)

jcze91April 29, 20200 reactions

Hello, Thx for your response but it's not my use case. I don't want to disable a block drag'n'drop on all the canvas, but I jus want this block to not to be added before another specific component.

artfMay 4, 20200 reactions

You can see if you're able to achieve it with by using the draggable property (Component) or make use of block:drag:stop event to ensure if the dropped component meets the necessary criteria and remove it if it doesn't

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.