chore: docs

This commit is contained in:
mathuo 2023-02-25 19:04:42 +08:00
parent acdad8f439
commit 4222d32b8d
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
2 changed files with 33 additions and 1 deletions

View File

@ -13,16 +13,19 @@ If you feel anything is missing or unclear please let me know.
## 🚀 Features
- magnetic dnd controls [#177](https://github.com/mathuo/dockview/pull/177)
- Allow drag events to edge of dockview containers [#177](https://github.com/mathuo/dockview/pull/177)
- group dnd [#171](https://github.com/mathuo/dockview/pull/171)
- full width tabs [#171](https://github.com/mathuo/dockview/pull/177)
- addPanel improvements
- update parameters via panel.api.updateParameters
- allow dnd on empty groups [#168](https://github.com/mathuo/dockview/pull/168)
- Change watermark logic [#194](https://github.com/mathuo/dockview/pull/194)
## 🛠 Miscs
- Fix dockview panel.api.setSize to work as expected [#184](https://github.com/mathuo/dockview/pull/184)
- Fix dockview setTitle [#190](https://github.com/mathuo/dockview/pull/190)
- Fix group dnd logic to filter for same dockview instance [#185](https://github.com/mathuo/dockview/pull/193)
- Update dependencies including the dev dependencies for dockview and all dependencies for the docs website.
[#180](https://github.com/mathuo/dockview/pull/180)
- A variety of internal changes including file name changes

View File

@ -1,4 +1,5 @@
import {
DockviewApi,
DockviewReact,
DockviewReadyEvent,
IDockviewPanelProps,
@ -33,6 +34,8 @@ const counter = (() => {
})();
const Watermark = (props: IWatermarkPanelProps) => {
const isGroup = props.containerApi.groups.length > 0;
const addPanel = () => {
props.containerApi.addPanel({
id: counter.next().toString(),
@ -63,12 +66,25 @@ const Watermark = (props: IWatermarkPanelProps) => {
<span>
<button onClick={addPanel}>Add New Panel</button>
</span>
{isGroup && (
<span>
<button
onClick={() => {
props.close();
}}
>
Close Group
</button>
</span>
)}
</div>
</div>
);
};
export const DockviewWatermark = () => {
const [api, setApi] = React.useState<DockviewApi>();
const onReady = (event: DockviewReadyEvent) => {
// event.api.addPanel({
// id: 'panel_1',
@ -84,6 +100,16 @@ export const DockviewWatermark = () => {
},
panels: {},
});
setApi(event.api);
};
const onClick = () => {
if (!api) {
return;
}
api.addGroup();
};
return (
@ -94,6 +120,9 @@ export const DockviewWatermark = () => {
flexDirection: 'column',
}}
>
<div>
<button onClick={onClick}>Add Empty Group</button>
</div>
<DockviewReact
onReady={onReady}
components={components}