Restricting Drop on Wrapper Component
Question
Version: 0.16.22 Are you able to reproduce the bug from the demo? [ ] Yes [ X] No - requires editing js. What is the expected behavior? wrapper component should not be droppable once droppable attribute is set to false. What is the current behavior? Nothing happens when this attribute is set. Describe the bug detailed Child components can be restricted using data-gjs-droppable=".foo" or data-gjs-droppable="false", but this attribute does nothing when set on the wrapper component using the DomComponent API. I have tried adding them using domComponents in init, directly after init, or waiting f...
Answers (3)
Hi @BillTheGoat try this after init:
editor.getWrapper().set({
'droppable': false
});
I think it's because the wrapper doesn't make part of DomComponents. DomComponents are only the components inside of the wrapper. :smile:
Hmmm. I tried this because the API docs list the DomComponents.getWrapper() as its first function, and it does apply attributes as seen in my sandbox above. It was doubly odd to me because it seems like the editor.getWrapper() function is just a wrapper for editor.get("DomComponents").getWrapper()...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3681
Textable not working with extended text component
Version: 0.17.22 Are you able to reproduce the bug from the demo?[X] Yes[ ] No What is the expected behavior? Should be able to drop a text...
Issue #3295
BUG (v0.16.41): Button component with draggable property is not working properly
Version: v0.16.41 Are you able to reproduce the bug from the demo? [ ] Yes [ ] No What is the expected behavior? When we have a button with...
Issue #3131
Paste as plain text into Text component adds <font /> wrapper to pasted text
Version: 0.16.27 Are you able to reproduce the bug from the demo? [] Yes [X] No What is the expected behavior? Paste as plain text (text no...
Issue #3352
Default Content is getting Inserted while using setComponents if Tag Body is empty
Version: Latest You can get the version by typing grapesjs.version into the console Are you able to reproduce the bug from the demo?[X] Yes...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.