Fix disappearing right sidebar

This commit is contained in:
Eduard Kuzmenko 2022-08-21 14:15:27 +02:00
parent db6a30c059
commit d524111932
2 changed files with 16 additions and 0 deletions

View File

@ -49,7 +49,17 @@ export class AppSidebarRight extends SidebarSlider {
public replaceSharedMediaTab(tab?: AppSharedMediaTab) {
const previousTab = this.sharedMediaTab;
if(previousTab) {
const idx = this.historyTabIds.indexOf(previousTab);
if(this._selectTab.getFrom() === previousTab.container) {
this._selectTab.setFrom(tab.container);
}
if(tab) {
if(idx !== -1) {
this.historyTabIds[idx] = tab;
}
const wasActive = previousTab.container.classList.contains('active');
if(wasActive) {
tab.container.classList.add('active');
@ -57,6 +67,10 @@ export class AppSidebarRight extends SidebarSlider {
previousTab.container.replaceWith(tab.container);
} else {
if(idx !== -1) {
this.historyTabIds.splice(idx, 1);
}
previousTab.container.remove();
}
} else {

View File

@ -296,6 +296,8 @@ const Transition = (
// selectTab.prevId = -1;
selectTab.prevId = () => from ? whichChild(from) : -1;
selectTab.getFrom = () => from;
selectTab.setFrom = (_from: HTMLElement) => from = _from;
return selectTab;
};