-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(DockView): add onPanelVisibleChanged event #981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
426edeb
060ffbb
4f6cf76
0815046
5c58226
e16923c
082d3a1
c9ba424
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,31 +8,30 @@ const onAddPanel = panel => { | |||||||||||||||||||||||||||||
| observePanelActiveChange(panel) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| const observePanelActiveChange = panel => { | ||||||||||||||||||||||||||||||
|
Comment on lines
8
to
10
|
||||||||||||||||||||||||||||||
| observePanelActiveChange(panel) | |
| } | |
| const observePanelActiveChange = panel => { | |
| observePanelVisibilityChange(panel) | |
| } | |
| const observePanelVisibilityChange = panel => { |
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saveConfig is now only triggered on visibility changes when renderer === 'onlyWhenVisible'. For renderer === 'partial' or 'always', switching tabs will still change which panel is active/visible, but config won’t be persisted to localStorage anymore (active panel can be lost on reload). Consider saving config on the relevant active/visibility transition regardless of renderer (keeping any maximized/initialization guards as needed).
| if (renderer === 'onlyWhenVisible' && dockview._inited) { | |
| if (isVisible) { | |
| saveConfig(panel.accessor) | |
| const visiblePanels = dockview.groups.map(g => g.panels.find(p => p.params.isActive) || g.panels.find(p => p.api.isVisible)) | |
| dockview._loadTabs?.fire(visiblePanels.filter(p => Boolean(p)).map(p => p.params.key)); | |
| } | |
| else { | |
| if (dockview._inited) { | |
| if (isVisible) { | |
| saveConfig(panel.accessor) | |
| const visiblePanels = dockview.groups.map(g => g.panels.find(p => p.params.isActive) || g.panels.find(p => p.api.isVisible)) | |
| dockview._loadTabs?.fire(visiblePanels.filter(p => Boolean(p)).map(p => p.params.key)); | |
| } | |
| else if (renderer === 'onlyWhenVisible') { |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -88,6 +88,10 @@ const initDockview = (dockview, options, template) => { | |||||
| }) | ||||||
| const handler = setTimeout(() => { | ||||||
| clearTimeout(handler); | ||||||
| if (dockview._isDisposed) { | ||||||
| dockview = null; | ||||||
| return; | ||||||
| } | ||||||
| const panels = dockview.panels; | ||||||
| const groups = dockview.groups; | ||||||
| const delPanelsStr = localStorage.getItem(dockview.params.options.localStorageKey + '-panels'); | ||||||
|
|
@@ -133,17 +137,17 @@ const initDockview = (dockview, options, template) => { | |||||
| dockview.groups.forEach(group => { | ||||||
| observeGroup(group) | ||||||
| }) | ||||||
| dockview.element.querySelector('&>.dv-dockview>.dv-branch-node').addEventListener('click', function(e) { | ||||||
| this.parentElement.querySelectorAll('&>.dv-resize-container-drawer, &>.dv-render-overlay-float-drawer').forEach(item => { | ||||||
| dockview.element.querySelector('&>.dv-dockview>.dv-branch-node')?.addEventListener('click', function(e) { | ||||||
| this.parentElement.querySelectorAll('&>.dv-resize-container-drawer, &>.dv-render-overlay-float-drawer')?.forEach(item => { | ||||||
| item.classList.remove('active') | ||||||
| }) | ||||||
| this.closest('.bb-dockview').querySelectorAll('&>.bb-dockview-aside>.bb-dockview-aside-button').forEach(item => { | ||||||
| this.closest('.bb-dockview').querySelectorAll('&>.bb-dockview-aside>.bb-dockview-aside-button')?.forEach(item => { | ||||||
| item.classList.remove('active') | ||||||
|
Comment on lines
+140
to
145
|
||||||
| }) | ||||||
| }) | ||||||
| dockview._inited = true; | ||||||
| dockview._initialized?.fire(); | ||||||
| }, 100); | ||||||
| }, 0); | ||||||
| }) | ||||||
|
|
||||||
| dockview.gridview.onDidChange(event => { | ||||||
|
|
@@ -223,16 +227,23 @@ const setWidth = (target, dockview) => { | |||||
| group.panels[0] && group.panels[0].api.setActive() | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| const cleanUndefined = (obj) => Object.fromEntries( | ||||||
| Object.entries(obj).filter(([, v]) => v != null) | ||||||
|
Comment on lines
+230
to
+231
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Filtering with Using
|
||||||
| Object.entries(obj).filter(([, v]) => v != null) | |
| Object.entries(obj).filter(([, v]) => v !== undefined) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR metadata is inconsistent (description says fixes #980, while the referenced PR text says fixes #979), and this diff also changes the package version from
10.0.8-beta06to10.0.8. If a stable release is intended, please align the issue reference(s) and call out the version bump explicitly; otherwise consider keeping the pre-release suffix for a feature PR.