mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge pull request #2976 from 4Science/DURACOM-253
Fix issue with the admin sidebar scrollbar on Firefox/Windows
This commit is contained in:
@@ -138,3 +138,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep {
|
||||||
|
.browser-firefox-windows {
|
||||||
|
--ds-dark-scrollbar-width: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
{{ 'root.skip-to-content' | translate }}
|
{{ 'root.skip-to-content' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="outer-wrapper" [class.d-none]="shouldShowFullscreenLoader" [@slideSidebarPadding]="{
|
<div class="outer-wrapper" [class.d-none]="shouldShowFullscreenLoader" [ngClass]="browserOsClasses.asObservable() | async" [@slideSidebarPadding]="{
|
||||||
value: ((isSidebarVisible$ | async) !== true ? 'hidden' : (slideSidebarOver$ | async) ? 'unpinned' : 'pinned'),
|
value: ((isSidebarVisible$ | async) !== true ? 'hidden' : (slideSidebarOver$ | async) ? 'unpinned' : 'pinned'),
|
||||||
params: { collapsedWidth: (collapsedSidebarWidth$ | async), expandedWidth: (expandedSidebarWidth$ | async) }
|
params: { collapsedWidth: (collapsedSidebarWidth$ | async), expandedWidth: (expandedSidebarWidth$ | async) }
|
||||||
}">
|
}">
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
|
NgClass,
|
||||||
NgIf,
|
NgIf,
|
||||||
} from '@angular/common';
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
Inject,
|
||||||
Input,
|
Input,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
@@ -13,6 +15,7 @@ import {
|
|||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
|
BehaviorSubject,
|
||||||
combineLatest as combineLatestObservable,
|
combineLatest as combineLatestObservable,
|
||||||
Observable,
|
Observable,
|
||||||
of,
|
of,
|
||||||
@@ -30,6 +33,10 @@ import { environment } from '../../environments/environment';
|
|||||||
import { ThemedAdminSidebarComponent } from '../admin/admin-sidebar/themed-admin-sidebar.component';
|
import { ThemedAdminSidebarComponent } from '../admin/admin-sidebar/themed-admin-sidebar.component';
|
||||||
import { getPageInternalServerErrorRoute } from '../app-routing-paths';
|
import { getPageInternalServerErrorRoute } from '../app-routing-paths';
|
||||||
import { ThemedBreadcrumbsComponent } from '../breadcrumbs/themed-breadcrumbs.component';
|
import { ThemedBreadcrumbsComponent } from '../breadcrumbs/themed-breadcrumbs.component';
|
||||||
|
import {
|
||||||
|
NativeWindowRef,
|
||||||
|
NativeWindowService,
|
||||||
|
} from '../core/services/window.service';
|
||||||
import { ThemedFooterComponent } from '../footer/themed-footer.component';
|
import { ThemedFooterComponent } from '../footer/themed-footer.component';
|
||||||
import { ThemedHeaderNavbarWrapperComponent } from '../header-nav-wrapper/themed-header-navbar-wrapper.component';
|
import { ThemedHeaderNavbarWrapperComponent } from '../header-nav-wrapper/themed-header-navbar-wrapper.component';
|
||||||
import { slideSidebarPadding } from '../shared/animations/slide';
|
import { slideSidebarPadding } from '../shared/animations/slide';
|
||||||
@@ -47,7 +54,20 @@ import { SystemWideAlertBannerComponent } from '../system-wide-alert/alert-banne
|
|||||||
styleUrls: ['./root.component.scss'],
|
styleUrls: ['./root.component.scss'],
|
||||||
animations: [slideSidebarPadding],
|
animations: [slideSidebarPadding],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [TranslateModule, ThemedAdminSidebarComponent, SystemWideAlertBannerComponent, ThemedHeaderNavbarWrapperComponent, ThemedBreadcrumbsComponent, NgIf, ThemedLoadingComponent, RouterOutlet, ThemedFooterComponent, NotificationsBoardComponent, AsyncPipe],
|
imports: [
|
||||||
|
TranslateModule,
|
||||||
|
ThemedAdminSidebarComponent,
|
||||||
|
SystemWideAlertBannerComponent,
|
||||||
|
ThemedHeaderNavbarWrapperComponent,
|
||||||
|
ThemedBreadcrumbsComponent,
|
||||||
|
NgIf,
|
||||||
|
NgClass,
|
||||||
|
ThemedLoadingComponent,
|
||||||
|
RouterOutlet,
|
||||||
|
ThemedFooterComponent,
|
||||||
|
NotificationsBoardComponent,
|
||||||
|
AsyncPipe,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class RootComponent implements OnInit {
|
export class RootComponent implements OnInit {
|
||||||
theme: Observable<ThemeConfig> = of({} as any);
|
theme: Observable<ThemeConfig> = of({} as any);
|
||||||
@@ -58,6 +78,8 @@ export class RootComponent implements OnInit {
|
|||||||
notificationOptions: INotificationBoardOptions;
|
notificationOptions: INotificationBoardOptions;
|
||||||
models: any;
|
models: any;
|
||||||
|
|
||||||
|
browserOsClasses = new BehaviorSubject<string[]>([]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not to show a full screen loader
|
* Whether or not to show a full screen loader
|
||||||
*/
|
*/
|
||||||
@@ -73,11 +95,23 @@ export class RootComponent implements OnInit {
|
|||||||
private cssService: CSSVariableService,
|
private cssService: CSSVariableService,
|
||||||
private menuService: MenuService,
|
private menuService: MenuService,
|
||||||
private windowService: HostWindowService,
|
private windowService: HostWindowService,
|
||||||
|
@Inject(NativeWindowService) private _window: NativeWindowRef,
|
||||||
) {
|
) {
|
||||||
this.notificationOptions = environment.notifications;
|
this.notificationOptions = environment.notifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
const browserName = this.getBrowserName();
|
||||||
|
if (browserName) {
|
||||||
|
const browserOsClasses = new Array<string>();
|
||||||
|
browserOsClasses.push(`browser-${browserName}`);
|
||||||
|
const osName = this.getOSName();
|
||||||
|
if (osName) {
|
||||||
|
browserOsClasses.push(`browser-${browserName}-${osName}`);
|
||||||
|
}
|
||||||
|
this.browserOsClasses.next(browserOsClasses);
|
||||||
|
}
|
||||||
|
|
||||||
this.isSidebarVisible$ = this.menuService.isMenuVisibleWithVisibleSections(MenuID.ADMIN);
|
this.isSidebarVisible$ = this.menuService.isMenuVisibleWithVisibleSections(MenuID.ADMIN);
|
||||||
|
|
||||||
this.expandedSidebarWidth$ = this.cssService.getVariable('--ds-admin-sidebar-total-width').pipe(
|
this.expandedSidebarWidth$ = this.cssService.getVariable('--ds-admin-sidebar-total-width').pipe(
|
||||||
@@ -108,4 +142,23 @@ export class RootComponent implements OnInit {
|
|||||||
mainContent.focus();
|
mainContent.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBrowserName(): string {
|
||||||
|
const userAgent = this._window.nativeWindow.navigator.userAgent;
|
||||||
|
if (/Firefox/.test(userAgent)) {
|
||||||
|
return 'firefox';
|
||||||
|
}
|
||||||
|
if (/Safari/.test(userAgent)) {
|
||||||
|
return 'safari';
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
getOSName(): string {
|
||||||
|
const userAgent = this._window.nativeWindow.navigator.userAgent;
|
||||||
|
if (/Windows/.test(userAgent)) {
|
||||||
|
return 'windows';
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
|
NgClass,
|
||||||
NgIf,
|
NgIf,
|
||||||
} from '@angular/common';
|
} from '@angular/common';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
@@ -24,7 +25,20 @@ import { SystemWideAlertBannerComponent } from '../../../../app/system-wide-aler
|
|||||||
templateUrl: '../../../../app/root/root.component.html',
|
templateUrl: '../../../../app/root/root.component.html',
|
||||||
animations: [slideSidebarPadding],
|
animations: [slideSidebarPadding],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [TranslateModule, ThemedAdminSidebarComponent, SystemWideAlertBannerComponent, ThemedHeaderNavbarWrapperComponent, ThemedBreadcrumbsComponent, NgIf, ThemedLoadingComponent, RouterOutlet, ThemedFooterComponent, NotificationsBoardComponent, AsyncPipe],
|
imports: [
|
||||||
|
TranslateModule,
|
||||||
|
ThemedAdminSidebarComponent,
|
||||||
|
SystemWideAlertBannerComponent,
|
||||||
|
ThemedHeaderNavbarWrapperComponent,
|
||||||
|
ThemedBreadcrumbsComponent,
|
||||||
|
NgIf,
|
||||||
|
NgClass,
|
||||||
|
ThemedLoadingComponent,
|
||||||
|
RouterOutlet,
|
||||||
|
ThemedFooterComponent,
|
||||||
|
NotificationsBoardComponent,
|
||||||
|
AsyncPipe,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class RootComponent extends BaseComponent {
|
export class RootComponent extends BaseComponent {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user