[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)
From the latest release https://github.com/artf/grapesjs/releases/tag/v0.16.12 you can pass disable property to your block
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.
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.
Issue #3409
[QUESTION] Custom component property that is not a trait
I would like to create a custom component with a property that will be updated by specific code, but I don't want this property to be visib...
Issue #2463
Not able to implement it with iframe. "CONTAINER" in frame and "BLOCK" outside the frame
Hello Team, I m new to grapejs and little bit fresher in JS. What i have to achieve => I have to make display the container in iframe which...
Issue #2380
[QUESTION] Support multiple languages for the page content
What we need is to create a page once but translate the text content in multiple languages. Imagine a very simple sample of a single text b...
Issue #1880
[QUESTION] Disable drop only for a specific block
Hello, There is a way to specify the blocks that should NOT be able to be inserted within a specific droppable block?
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.