@@ -20,6 +20,9 @@ import { Bookmark } from './core/model/bookmark';
20
20
import { Router } from '@angular/router' ;
21
21
import { AddToHistoryService } from './core/user/add-to-history.service' ;
22
22
import { environment } from '../environments/environment' ;
23
+ import { ScrollStrategyOptions } from '@angular/cdk/overlay' ;
24
+ import { ScrollStrategy } from '@angular/cdk/overlay/scroll/scroll-strategy' ;
25
+ import { LoginDialogHelperService } from './core/login-dialog-helper.service' ;
23
26
24
27
@Component ( {
25
28
selector : 'app-root' ,
@@ -45,17 +48,21 @@ export class AppComponent implements OnInit {
45
48
favIcon : HTMLLinkElement = document . querySelector ( '#favicon' ) ;
46
49
readonly environment = environment ;
47
50
51
+ scrollStrategy : ScrollStrategy ;
52
+
48
53
constructor ( private keycloakService : KeycloakService ,
49
54
private userInfoStore : UserInfoStore ,
50
55
private userDataStore : UserDataStore ,
51
56
private userDataHistoryStore : UserDataHistoryStore ,
52
57
private userDataPinnedStore : UserDataPinnedStore ,
53
58
private historyDialog : MatDialog ,
54
59
private loginDialog : MatDialog ,
60
+ private loginDialogHelperService : LoginDialogHelperService ,
55
61
private cookieService : CookieService ,
56
62
private feedbackService : FeedbackService ,
57
63
protected router : Router ,
58
- private addToHistoryService : AddToHistoryService ) {
64
+ private addToHistoryService : AddToHistoryService ,
65
+ private readonly scrollStrategyOptions : ScrollStrategyOptions ) {
59
66
this . innerWidth = 100 ;
60
67
}
61
68
@@ -86,18 +93,13 @@ export class AppComponent implements OnInit {
86
93
)
87
94
}
88
95
} ) ;
96
+ this . scrollStrategy = this . scrollStrategyOptions . noop ( ) ;
89
97
}
90
98
91
99
@HostListener ( 'window:keydown.control.p' , [ '$event' ] )
92
100
showPinned ( event : KeyboardEvent ) {
93
101
if ( ! this . userIsLoggedIn ) {
94
- const dialogConfig = new MatDialogConfig ( ) ;
95
-
96
- dialogConfig . disableClose = true ;
97
- dialogConfig . autoFocus = true ;
98
- dialogConfig . data = {
99
- message : 'You need to be logged in to see the Pinned Bookmarks popup'
100
- } ;
102
+ const dialogConfig = this . loginDialogHelperService . loginDialogConfig ( 'You need to be logged in to see the Pinned Bookmarks popup' ) ;
101
103
102
104
this . loginDialog . open ( LoginRequiredDialogComponent , dialogConfig ) ;
103
105
} else {
@@ -108,6 +110,7 @@ export class AppComponent implements OnInit {
108
110
dialogConfig . autoFocus = true ;
109
111
dialogConfig . width = this . getRelativeWidth ( ) ;
110
112
dialogConfig . height = this . getRelativeHeight ( ) ;
113
+ dialogConfig . scrollStrategy = this . scrollStrategy ;
111
114
dialogConfig . data = {
112
115
bookmarks$ : this . userDataPinnedStore . getPinnedBookmarks$ ( this . userId , 1 ) ,
113
116
title : '<i class="fas fa-thumbtack"></i> Pinned'
@@ -143,13 +146,7 @@ export class AppComponent implements OnInit {
143
146
@HostListener ( 'window:keydown.control.h' , [ '$event' ] )
144
147
showHistory ( event : KeyboardEvent ) {
145
148
if ( ! this . userIsLoggedIn ) {
146
- const dialogConfig = new MatDialogConfig ( ) ;
147
-
148
- dialogConfig . disableClose = true ;
149
- dialogConfig . autoFocus = true ;
150
- dialogConfig . data = {
151
- message : 'You need to be logged in to see the History Bookmarks popup'
152
- } ;
149
+ const dialogConfig = this . loginDialogHelperService . loginDialogConfig ( 'You need to be logged in to see the History Bookmarks popup' ) ;
153
150
154
151
this . loginDialog . open ( LoginRequiredDialogComponent , dialogConfig ) ;
155
152
} else {
@@ -160,6 +157,7 @@ export class AppComponent implements OnInit {
160
157
dialogConfig . autoFocus = true ;
161
158
dialogConfig . width = this . getRelativeWidth ( ) ;
162
159
dialogConfig . height = this . getRelativeHeight ( ) ;
160
+ dialogConfig . scrollStrategy = this . scrollStrategy ;
163
161
dialogConfig . data = {
164
162
bookmarks$ : this . userDataHistoryStore . getAllHistory$ ( this . userId ) ,
165
163
title : '<i class="fas fa-history"></i> History'
0 commit comments