Skip to content

Commit bd43903

Browse files
committed
Don't open hidden side panels on tab reload
1 parent 4cc3883 commit bd43903

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/editor/ui/tab_container/tab_container.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func (t *TabContainer) ReloadTabs(name string, forceOpen bool) bool {
329329
found := false
330330
for i := range t.Tabs {
331331
if t.Tabs[i].Label == name {
332-
if t.doc != nil || forceOpen {
332+
if (t.doc != nil && t.doc.IsActive()) || forceOpen {
333333
if t.activeTab == i {
334334
t.reload()
335335
} else {

src/markup/document/html_parser.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,14 @@ func DocumentFromHTMLString(uiMan *ui.Manager, htmlStr string, withData any, fun
355355
return parsed
356356
}
357357

358+
func (d *Document) IsActive() bool {
359+
anyActive := false
360+
for i := range d.Elements {
361+
anyActive = anyActive || d.Elements[i].UI.Entity().IsActive()
362+
}
363+
return anyActive
364+
}
365+
358366
func (d *Document) Activate() {
359367
for i := range d.Elements {
360368
d.Elements[i].UI.Entity().Activate()

0 commit comments

Comments
 (0)