Comments (4)
Closing since this is working in the latest version. Example included on docs website now with panels using third-party dnd controls at https://dockview.dev/docs/components/dockview#third-party-dnd-libraries
from dockview.
Hi - Yes I guess there could be some conflict here that I haven't accounted for in terms of external dnd events. I will certainly take a look at fixing it though since dockview shouldn't interfere with other libraries, or at a minimum it should provide a way to prevent the interferance.
Would it be possible for you to add a small example just so I can see the exact problem? Potentially adding a react-dnd item into this existing sandbox (https://codesandbox.io/s/github/mathuo/dockview/tree/master/packages/docs/sandboxes/simple-dockview) to show the problem?
from dockview.
Thanks for a quick response, @mathuo !
I created two example sandboxes, one with react-dnd
on top of the tree, one inside of dockview:
https://codesandbox.io/s/dockview-treeview-4eu1p1 - top
https://codesandbox.io/s/dockview-treeview-dnd-inside-811g65 - inside
In both cases, the drag-and-drop behavior of both components is broken.
from dockview.
Amazing, thank you. Two findings from some very quick work (so I may be wrong):
react-dnd
intercepts dnd events within it's scope (which dockview would be) and will call.preventDefault()
ondragStart
events if it thinks the drag event isn't valid. It seems dockview doesn't set some properties which technically should be set according to some dnd specs soreact-dnd
invalids thedragStart
events through.preventDefault()
- you'll see this in the workings in both of your examples because the tabs are no longer draggable. To fix this I will set some additional properties on the drag events I am creating to conform to some technicalities.
You can see this here in the
react-dnd
source code where it treats any drag events without a validdataTransfer.types
to be invalid.
- You're findings in
dropTarget.ts
seem valid to me and that calling.stopPropagation()
here isn't great because it has the potential to interfer with external events. To fix this I will remove.stopPropagation()
here and selectively apply it only when I know that the event should be intercepted bydockview
and used by nobody else.
I've started a branch but will need a bit of work to fine tune the two fixes above. Here is a link to a sandbox of your example built from that branch, let me know if this looks better?
from dockview.
Related Issues (20)
- Feature request: dropdown menu to handle overflow tabs
- Sonar Suggestions
- Gap between panels leads to some panels' size overflow HOT 6
- `api.toJSON()` and `api.fromJSON()` should be be renamed, as they use JS Objects and not JSON.
- setTitle issues HOT 1
- dockview-vue error Cannot read properties of null (reading 'appContext') HOT 1
- docs
- After all the groups in the branch are hidden, an error is reported when calling fromJSON() HOT 3
- Allow custom renderer for group header (or tabs container) HOT 1
- Initial width and height of a docker panel HOT 2
- bug:After the drag and drop, the size of the group was evenly distributed, and I want to maintain their original size as much as possible HOT 2
- When I was using this project, I encountered three tricky issues HOT 1
- [Released] Dockview 1.15.0 Iteration Plan
- How to set minimum and maximum panel sizes in DockView? HOT 1
- Panel and Group default sizes and bounding dimensions
- Dockview 1.16.0 Iteration Plan
- Nested views resize lag
- 1.15 removed types that are still valid HOT 1
- fix passing through options for opening single panel in a popot window HOT 1
- Offical support for Vanilla TypeScript
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockview.