Browse Source

Fix disappearing right sidebar

master
Eduard Kuzmenko 2 years ago
parent
commit
b97fdcf877
  1. 14
      src/components/sidebarRight/index.ts
  2. 2
      src/components/transition.ts

14
src/components/sidebarRight/index.ts

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

2
src/components/transition.ts

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

Loading…
Cancel
Save