Merge pull request #511 from knorrium/improve_scrolling_between_routes

Improve scrolling between routes
This commit is contained in:
wiz 2021-05-13 02:03:14 +09:00 committed by GitHub
commit bbd21c9401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -298,7 +298,9 @@ if (browserWindowEnv && browserWindowEnv.OFFICIAL_BISQ_MARKETS) {
@NgModule({ @NgModule({
imports: [RouterModule.forRoot(routes, { imports: [RouterModule.forRoot(routes, {
initialNavigation: 'enabled' initialNavigation: 'enabled',
scrollPositionRestoration: 'enabled',
anchorScrolling: 'enabled'
})], })],
exports: [RouterModule] exports: [RouterModule]
}) })

View File

@ -1,6 +1,6 @@
<div class="container-xl"> <div class="container-xl">
<div class="title-block"> <div class="title-block" id="block">
<h1><ng-template [ngIf]="blockHeight === 0" i18n="block.genesis">Genesis </ng-template><ng-template [ngIf]="blockHeight" i18n="block.block">Block <a [routerLink]="['/block/' | relativeUrl, blockHash]">{{ blockHeight }}</a></ng-template></h1> <h1><ng-template [ngIf]="blockHeight === 0" i18n="block.genesis">Genesis </ng-template><ng-template [ngIf]="blockHeight" i18n="block.block">Block <a [routerLink]="['/block/' | relativeUrl, blockHash]">{{ blockHeight }}</a></ng-template></h1>
<button [routerLink]="['/' | relativeUrl]" class="btn btn-sm">&#10005;</button> <button [routerLink]="['/' | relativeUrl]" class="btn btn-sm">&#10005;</button>
</div> </div>
@ -80,7 +80,7 @@
</div> </div>
</div> </div>
<div [hidden]="!showDetails"> <div [hidden]="!showDetails" id="details">
<br> <br>
<div class="box"> <div class="box">

View File

@ -192,6 +192,7 @@ export class BlockComponent implements OnInit, OnDestroy {
relativeTo: this.route, relativeTo: this.route,
queryParams: { showDetails: false }, queryParams: { showDetails: false },
queryParamsHandling: 'merge', queryParamsHandling: 'merge',
fragment: 'block'
}); });
} else { } else {
this.showDetails = true; this.showDetails = true;
@ -199,6 +200,7 @@ export class BlockComponent implements OnInit, OnDestroy {
relativeTo: this.route, relativeTo: this.route,
queryParams: { showDetails: true }, queryParams: { showDetails: true },
queryParamsHandling: 'merge', queryParamsHandling: 'merge',
fragment: 'details'
}); });
} }
} }