ticlo / rc-dock

Dock Layout for React Component
https://ticlo.github.io/rc-dock/examples
Apache License 2.0
684 stars 96 forks source link

How to add content to blank main window? #216

Open adityatoshniwal opened 1 year ago

adityatoshniwal commented 1 year ago

Hi,

I have created a main panel(locked) with all tabs closable. I want to show something on the blank main panel when all the panels are closed. How can I do that?

Thanks.

rayman-de commented 1 year ago

Give your main panel an id (e.g. "main") and then use dockMove(newTabData, "main", "middle") to add a tab to your main panel. (newTabData should hold the TabData of the content that you want to show., e.g. let newTabData = {content: <div>This is a new tab</div>, title: "New Tab", closable: true})

adityatoshniwal commented 1 year ago

@rayman-de That's the tab content. I am talking about the panel content when all the tabs are closed.

rayman-de commented 1 year ago

A panel is a container for tabs, it is not meant to hold content by itself. As a workaround, you could pass a handler to the DockLayout's onLayoutChange prop that switches the layout with a placeholder once the panel has no tabs.

adityatoshniwal commented 1 year ago

@rayman-de I understand. But a panel can be blank - if it can be blank then it should allow some content. Taking an example of VS-Code which shows some content when no tabs are open.

image