Floating Windows, OS Pop-out & Persistence
1. Floating Tear-Off Windows
- Drag a tab outside the container (or
Alt+drag) to detach it into a floating window (controller.floatView()/controller.floatGroup()). - Supports 8-way resizing, focus z-order stacking, viewport clamping, and one-click re-docking (
controller.redockFloatingGroup(floatingId)). - Detached views receive
isFloating: trueinRedDokiaViewRenderProps.
Close (×) & Auto-Return Policy Across Floating / Pop-out Windows
| View Category | Behavior on Floating Window Close (×) or OS Pop-out Close |
|---|---|
Closable Tab (closable !== false) | Clicking × on a floating window closes the tab (respecting onBeforeCloseView). Closing an OS pop-out window automatically re-docks the tab into the main grid to prevent accidental data loss. |
Non-Closable Tab (closable: false) | Never destroyed; safely re-docks back into the main grid. |
EdgeBar Tool Panel | Remembers its originEdgeSlot and automatically docks back into its originating EdgeBar rail slot. |
2. Multi-Monitor OS Browser Pop-out (popoutView · popoutFavicon)
Detach a view (controller.popoutView(viewId)) or group (controller.popoutGroup(groupId)) into an OS browser window (window.open) while keeping state alive (isPopout: true). Call controller.recallPopoutView(viewId) to dock it back programmatically at any time.
text
[Main Window] ── popoutView() ──▶ [about:blank OS Window] (CSS · Theme · Favicon auto-synced)
▲ │
└──── window close / recall ──────────┘ (auto re-docks to original group or originEdgeSlot)Custom Pop-out Favicon (popoutFavicon)
Favicon resolution order:
- Explicit
popoutFaviconprop (URL ordata:image/svg+xmlURI) - Host document
<link rel*="icon">(live-synced viaMutationObserver) - Built-in RedDokia SVG favicon fallback
tsx
<RedDokia
views={views}
layout={layout}
popoutFavicon="/brand-popout-icon.svg"
/>Popup Blocker & Auto-Recovery
If window.open is blocked by the browser, RedDokia safely rolls back and keeps the view in the main window. Closing the OS pop-out window automatically re-docks the view without unmounting it.
3. Persistence (storageKey · JSON Snapshots)
| Mechanism | When to Use | API |
|---|---|---|
Auto-Save (storageKey) | Remember user workspace layout across page reloads in localStorage (opt-in; omit for memory-only) | <RedDokia storageKey="my-ide-v1" /> |
| Manual Snapshots (JSON) | Save/load layouts to a backend DB or .json project files (works with or without storageKey) | controller.exportLayoutJson() / controller.importLayoutJson(json) |
ts
// Capture a versioned JSON snapshot (splits, tabs, theme, EdgeBar labels, floating windows)
const snapshotJson = controller.exportLayoutJson();
// Restore the exact captured layout later
controller.importLayoutJson(snapshotJson);
// Reset back to the initial layoutSchema
controller.resetLayout();