question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Restricting Drop on Wrapper Component

See original GitHub issue

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 for editor onload. I have tired using attributes of droppable, data-droppable, and/or data-gjs-droppable. The use case for this is to make sure users can’t drop items outside my base template, since it would mess up post-processing. I am new to grapejs but find no info on this in issues or on stackoverflow/google etc.

Are you able to attach screenshots, screencasts or a live demo?

[X ] Yes (attach) [ ] No

https://codesandbox.io/s/kind-ritchie-5ue7i creates a wrapper like:

<div data-gjs-type="wrapper" draggable="true" data-highlightable="1" droppable="false" data-droppable="false" data-gjs-droppable="false" id="c55" class=""> ...

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
BillTheGoatcommented, Sep 11, 2020

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() in the source 😉.

Edit: in fact wrapper is inside domComponents init scope, so this works:

domComponents: {
    wrapper: {
	droppable: false,
    }
},

Thank you so much for your great work.

1reaction
RJCAMcommented, Sep 11, 2020

I think it’s because the wrapper doesn’t make part of DomComponents. DomComponents are only the components inside of the wrapper. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

wrap the root component in a <Provider>,or pass a custom ...
Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to...
Read more >
Inline flexbox width is wrongly calculated when wrapping ...
1. Setup an inline-flex container with flex-direction: column, flex-wrap: wrap and a fixed height. 2. Add some non-flexible elements inside (eg. flex: 0...
Read more >
How To Handle Async Data Loading, Lazy Loading, and Code ...
Now you need to import and render the new component to your root component. Open App. js : nano src/components/App/App.
Read more >
Create a drag-and-drop with react-dropzone - LogRocket Blog
Learn how to use react-dropzone to create a drag-and-drop component for uploading images. Compare this to the HTML Drag and Drop API method....
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug :2 - "How do I attach an ebuild. ... Bug:124 - "International Components for Unicode by IBM Developerworks" status:RESOLVED resolution:FIXED severity: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found