mirror of
https://github.com/mathuo/dockview
synced 2025-08-24 11:06:23 +00:00
feat: reintroduce panel.update(..) to public api
This commit is contained in:
parent
ff88de0395
commit
26f2908b39
@ -157,10 +157,6 @@ const components: PanelCollection<IDockviewPanelProps> = {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const onClick = () => {
|
||||
props.api.setState('test_key', 'hello');
|
||||
};
|
||||
|
||||
const backgroundColor = React.useMemo(
|
||||
() =>
|
||||
// "#1e1e1e",
|
||||
@ -241,7 +237,6 @@ const components: PanelCollection<IDockviewPanelProps> = {
|
||||
{`${panelState.isPanelVisible}`}
|
||||
</span>
|
||||
</div>
|
||||
<button onClick={onClick}>set state</button>
|
||||
<button onClick={onRename}>rename</button>
|
||||
|
||||
<input
|
||||
|
@ -56,8 +56,6 @@ const components = {
|
||||
},
|
||||
};
|
||||
|
||||
const SPLIT_PANEL_STATE_KEY = 'splitview_panel_state';
|
||||
|
||||
export const SplitPanel = (props: IDockviewPanelProps) => {
|
||||
const api = React.useRef<SplitviewApi>();
|
||||
const registry = useLayoutRegistry();
|
||||
@ -67,9 +65,6 @@ export const SplitPanel = (props: IDockviewPanelProps) => {
|
||||
props.api.onDidDimensionsChange((event) => {
|
||||
api.current?.layout(event.width, event.height - 25);
|
||||
}),
|
||||
api.current.onDidLayoutChange(() => {
|
||||
props.api.setState(SPLIT_PANEL_STATE_KEY, api.current.toJSON());
|
||||
}),
|
||||
props.api.onFocusEvent(() => {
|
||||
api.current.focus();
|
||||
})
|
||||
@ -98,11 +93,6 @@ export const SplitPanel = (props: IDockviewPanelProps) => {
|
||||
event.api.addPanel({ id: '2', component: 'default1' });
|
||||
};
|
||||
|
||||
const onSave = () => {
|
||||
props.api.setState(SPLIT_PANEL_STATE_KEY, api.current.toJSON());
|
||||
console.log(JSON.stringify(api.current.toJSON(), null, 4));
|
||||
};
|
||||
|
||||
const onUpdateProps = () => {
|
||||
const panel = api.current.getPanel('1');
|
||||
panel.update({ params: { text: Date.now().toString() } });
|
||||
|
@ -22,6 +22,7 @@ export interface BasePanelViewExported<T extends PanelApiImpl> {
|
||||
readonly params: Record<string, any> | undefined;
|
||||
focus(): void;
|
||||
toJSON(): object;
|
||||
update(event: PanelUpdateEvent): void;
|
||||
}
|
||||
|
||||
export abstract class BasePanelView<T extends PanelApiImpl>
|
||||
|
Loading…
x
Reference in New Issue
Block a user