Restrict draggable elements to parent?
Question
I'm not sure if this already exists and I haven't seen it yet (apologies if that's the case). Is there a way to restrict where certain draggable elements are droppable?
Say I have a list:
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
And I want the user to be able to rearrange the list items, but restrict them from dragging outside of the <ul>.
similar to http://api.jqueryui.com/draggable/#option-containment
Answers (3)
It seems you've thought of everything, you've done such an amazing job w/ GrapesJS! 😄
Sure, you can make use of data-gjs-* attributes (eg. data-gjs-draggable="ul")
Check the last example code here https://github.com/artf/grapesjs/wiki/Blocks
Thanks Austin :)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1009
[Question] Richtext editor for trait
Is there way to have richtext box for trait. We want to user to insert rich text for trait and not sure how can we do it. We have below use...
Issue #577
Only allow one component of specific type on editor
is there way to not allow to drop any specific component more than one time on page? I have custom component and user cannot drop it more t...
Issue #1307
Question: To stop dynamically generated classes in grapes Editor
Hi @artf is there any Way to stop dynamically generating classes on reloading editor. let say when i add my custom class i.e "my_class" to...
Issue #1420
Customizing Block(section block) While Dragging it
Hi I have seen that there was two separate blocks to add 'sections' and 'columns'.We have a flow like when we drag a section into canvas ne...
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.