Skip to content

Commit 5173922

Browse files
committed
chore: docs
1 parent 0ca56ea commit 5173922

File tree

6 files changed

+23
-34
lines changed

6 files changed

+23
-34
lines changed

packages/docs/docs/advanced/nested.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ import { CodeRunner } from '@site/src/components/ui/codeRunner';
88
# Nested Dockviews
99

1010
You can safely create multiple dockview instances within one page and nest dockviews within other dockviews.
11-
If you wish to interact with the drop event from one dockview instance in another dockview instance you can implement the `showDndOverlay` and `onDidDrop` props on `DockviewReact`.
11+
If you wish to interact with the drop event from one dockview instance in another dockview instance you can implement the `api.onUnhandledDragOverEvent` and `onDidDrop` props on `DockviewReact`.
1212

1313
<CodeRunner id="dockview/nested" />

packages/docs/docs/core/dnd/dragAndDrop.mdx

+12-10
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ For interaction with the Drag events directly the component exposes some method
4343
```tsx
4444
/**
4545
* called when an ondrop event which does not originate from the dockview libray and
46-
* passes the showDndOverlay condition occurs
46+
* passes the onUnhandledDragOverEvent condition
4747
**/
4848
const onDidDrop = (event: DockviewDropEvent) => {
4949
const { group } = event;
@@ -58,22 +58,24 @@ const onDidDrop = (event: DockviewDropEvent) => {
5858
});
5959
};
6060

61-
/**
62-
* called for drag over events which do not originate from the dockview library
63-
* allowing the developer to decide where the overlay should be shown for a
64-
* particular drag event
65-
**/
66-
const showDndOverlay = (event: DockviewDndOverlayEvent) => {
67-
return true;
68-
};
61+
const onReady = (event: DockviewReadyEvent) => {
62+
63+
/**
64+
* called for drag over events which do not originate from the dockview library
65+
* allowing the developer to decide where the overlay should be shown for a
66+
* particular drag event
67+
**/
68+
api.onUnhandledDragOverEvent(event => {
69+
event.accept();
70+
});
71+
}
6972

7073
return (
7174
<DockviewReact
7275
components={components}
7376
onReady={onReady}
7477
className="dockview-theme-abyss"
7578
onDidDrop={onDidDrop}
76-
showDndOverlay={showDndOverlay}
7779
/>
7880
);
7981
```

packages/docs/old_docs_DELETE_SOON/components/paneview/paneview.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ If you provide the `PaneviewReact` component with the prop `onDidDrop` you will
221221

222222
You can safely create multiple paneview instances within one page. They will not interact with each other by default.
223223

224-
If you wish to interact with the drop event from one paneview instance in another paneview instance you can implement the `showDndOverlay` and `onDidDrop` props on `PaneviewReact`.
224+
If you wish to interact with the drop event from one paneview instance in another paneview instance you can implement the `api.onUnhandledDragOverEvent` and `onDidDrop` props on `PaneviewReact`.
225225

226226
As an example see how dragging a header from one control to another will only trigger an interactable event for the developer if the checkbox is enabled.
227227

packages/docs/sandboxes/react/dockview/dnd-external/src/app.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
113113
}
114114
});
115115

116+
const disposable = api.onUnhandledDragOverEvent((event) => {
117+
event.accept();
118+
});
119+
116120
return () => {
121+
disposable.dispose();
117122
panelDragDisposable.dispose();
118123
groupDragDisposable.dispose();
119124
};
@@ -134,10 +139,6 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
134139
});
135140
};
136141

137-
const showDndOverlay = (event: DockviewDndOverlayEvent) => {
138-
return true;
139-
};
140-
141142
const onDrop = (event: React.DragEvent) => {
142143
const dataTransfer = event.dataTransfer;
143144

@@ -179,7 +180,6 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
179180
onReady={onReady}
180181
className={`${props.theme || 'dockview-theme-abyss'}`}
181182
onDidDrop={onDidDrop}
182-
showDndOverlay={showDndOverlay}
183183
rootOverlayModel={{
184184
size: { value: 100, type: 'pixels' },
185185
activationSize: { value: 5, type: 'percentage' },

packages/docs/templates/dockview/dnd-external/react/src/app.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
113113
}
114114
});
115115

116+
const disposable = api.onUnhandledDragOverEvent((event) => {
117+
event.accept();
118+
});
119+
116120
return () => {
117121
panelDragDisposable.dispose();
118122
groupDragDisposable.dispose();
@@ -134,10 +138,6 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
134138
});
135139
};
136140

137-
const showDndOverlay = (event: DockviewDndOverlayEvent) => {
138-
return true;
139-
};
140-
141141
const onDrop = (event: React.DragEvent) => {
142142
const dataTransfer = event.dataTransfer;
143143

@@ -179,7 +179,6 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
179179
onReady={onReady}
180180
className={`${props.theme || 'dockview-theme-abyss'}`}
181181
onDidDrop={onDidDrop}
182-
showDndOverlay={showDndOverlay}
183182
rootOverlayModel={{
184183
size: { value: 100, type: 'pixels' },
185184
activationSize: { value: 5, type: 'percentage' },

packages/docs/templates/dockview/nested/react/src/app.tsx

-12
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,11 @@ const NestedDockview = (props: { theme?: string }) => {
7070
});
7171
};
7272

73-
const showDndOverlay = (event: DockviewDndOverlayEvent) => {
74-
// console.log(event.getData());
75-
76-
return false;
77-
};
78-
79-
const onDidDrop = (event: DockviewDidDropEvent) => {
80-
// event.getData();
81-
};
82-
8373
return (
8474
<DockviewReact
8575
onReady={onReady}
8676
components={components}
8777
className={`${props.theme || 'dockview-theme-abyss'}`}
88-
showDndOverlay={showDndOverlay}
89-
onDidDrop={onDidDrop}
9078
/>
9179
);
9280
};

0 commit comments

Comments
 (0)