mirror of
https://github.com/mathuo/dockview
synced 2025-02-08 17:35:44 +00:00
chore: docs
This commit is contained in:
parent
0ca56eaa8a
commit
5173922c69
@ -8,6 +8,6 @@ import { CodeRunner } from '@site/src/components/ui/codeRunner';
|
|||||||
# Nested Dockviews
|
# Nested Dockviews
|
||||||
|
|
||||||
You can safely create multiple dockview instances within one page and nest dockviews within other dockviews.
|
You can safely create multiple dockview instances within one page and nest dockviews within other dockviews.
|
||||||
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`.
|
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`.
|
||||||
|
|
||||||
<CodeRunner id="dockview/nested" />
|
<CodeRunner id="dockview/nested" />
|
||||||
|
@ -43,7 +43,7 @@ For interaction with the Drag events directly the component exposes some method
|
|||||||
```tsx
|
```tsx
|
||||||
/**
|
/**
|
||||||
* called when an ondrop event which does not originate from the dockview libray and
|
* called when an ondrop event which does not originate from the dockview libray and
|
||||||
* passes the showDndOverlay condition occurs
|
* passes the onUnhandledDragOverEvent condition
|
||||||
**/
|
**/
|
||||||
const onDidDrop = (event: DockviewDropEvent) => {
|
const onDidDrop = (event: DockviewDropEvent) => {
|
||||||
const { group } = event;
|
const { group } = event;
|
||||||
@ -58,14 +58,17 @@ const onDidDrop = (event: DockviewDropEvent) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onReady = (event: DockviewReadyEvent) => {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called for drag over events which do not originate from the dockview library
|
* called for drag over events which do not originate from the dockview library
|
||||||
* allowing the developer to decide where the overlay should be shown for a
|
* allowing the developer to decide where the overlay should be shown for a
|
||||||
* particular drag event
|
* particular drag event
|
||||||
**/
|
**/
|
||||||
const showDndOverlay = (event: DockviewDndOverlayEvent) => {
|
api.onUnhandledDragOverEvent(event => {
|
||||||
return true;
|
event.accept();
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DockviewReact
|
<DockviewReact
|
||||||
@ -73,7 +76,6 @@ return (
|
|||||||
onReady={onReady}
|
onReady={onReady}
|
||||||
className="dockview-theme-abyss"
|
className="dockview-theme-abyss"
|
||||||
onDidDrop={onDidDrop}
|
onDidDrop={onDidDrop}
|
||||||
showDndOverlay={showDndOverlay}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -221,7 +221,7 @@ If you provide the `PaneviewReact` component with the prop `onDidDrop` you will
|
|||||||
|
|
||||||
You can safely create multiple paneview instances within one page. They will not interact with each other by default.
|
You can safely create multiple paneview instances within one page. They will not interact with each other by default.
|
||||||
|
|
||||||
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`.
|
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`.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
@ -113,7 +113,12 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const disposable = api.onUnhandledDragOverEvent((event) => {
|
||||||
|
event.accept();
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
disposable.dispose();
|
||||||
panelDragDisposable.dispose();
|
panelDragDisposable.dispose();
|
||||||
groupDragDisposable.dispose();
|
groupDragDisposable.dispose();
|
||||||
};
|
};
|
||||||
@ -134,10 +139,6 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const showDndOverlay = (event: DockviewDndOverlayEvent) => {
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDrop = (event: React.DragEvent) => {
|
const onDrop = (event: React.DragEvent) => {
|
||||||
const dataTransfer = event.dataTransfer;
|
const dataTransfer = event.dataTransfer;
|
||||||
|
|
||||||
@ -179,7 +180,6 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
|
|||||||
onReady={onReady}
|
onReady={onReady}
|
||||||
className={`${props.theme || 'dockview-theme-abyss'}`}
|
className={`${props.theme || 'dockview-theme-abyss'}`}
|
||||||
onDidDrop={onDidDrop}
|
onDidDrop={onDidDrop}
|
||||||
showDndOverlay={showDndOverlay}
|
|
||||||
rootOverlayModel={{
|
rootOverlayModel={{
|
||||||
size: { value: 100, type: 'pixels' },
|
size: { value: 100, type: 'pixels' },
|
||||||
activationSize: { value: 5, type: 'percentage' },
|
activationSize: { value: 5, type: 'percentage' },
|
||||||
|
@ -113,6 +113,10 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const disposable = api.onUnhandledDragOverEvent((event) => {
|
||||||
|
event.accept();
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
panelDragDisposable.dispose();
|
panelDragDisposable.dispose();
|
||||||
groupDragDisposable.dispose();
|
groupDragDisposable.dispose();
|
||||||
@ -134,10 +138,6 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const showDndOverlay = (event: DockviewDndOverlayEvent) => {
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDrop = (event: React.DragEvent) => {
|
const onDrop = (event: React.DragEvent) => {
|
||||||
const dataTransfer = event.dataTransfer;
|
const dataTransfer = event.dataTransfer;
|
||||||
|
|
||||||
@ -179,7 +179,6 @@ const DndDockview = (props: { renderVisibleOnly: boolean; theme?: string }) => {
|
|||||||
onReady={onReady}
|
onReady={onReady}
|
||||||
className={`${props.theme || 'dockview-theme-abyss'}`}
|
className={`${props.theme || 'dockview-theme-abyss'}`}
|
||||||
onDidDrop={onDidDrop}
|
onDidDrop={onDidDrop}
|
||||||
showDndOverlay={showDndOverlay}
|
|
||||||
rootOverlayModel={{
|
rootOverlayModel={{
|
||||||
size: { value: 100, type: 'pixels' },
|
size: { value: 100, type: 'pixels' },
|
||||||
activationSize: { value: 5, type: 'percentage' },
|
activationSize: { value: 5, type: 'percentage' },
|
||||||
|
@ -70,23 +70,11 @@ const NestedDockview = (props: { theme?: string }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const showDndOverlay = (event: DockviewDndOverlayEvent) => {
|
|
||||||
// console.log(event.getData());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDidDrop = (event: DockviewDidDropEvent) => {
|
|
||||||
// event.getData();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DockviewReact
|
<DockviewReact
|
||||||
onReady={onReady}
|
onReady={onReady}
|
||||||
components={components}
|
components={components}
|
||||||
className={`${props.theme || 'dockview-theme-abyss'}`}
|
className={`${props.theme || 'dockview-theme-abyss'}`}
|
||||||
showDndOverlay={showDndOverlay}
|
|
||||||
onDidDrop={onDidDrop}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user