parent
a788d585f8
commit
2f18e8565e
|
@ -1,35 +1,32 @@
|
||||||
import { NO_ERRORS_SCHEMA, DebugElement } from '@angular/core';
|
|
||||||
import { inject, ComponentFixture, TestBed, fakeAsync, flushMicrotasks, tick } from '@angular/core/testing';
|
|
||||||
import { Title } from '@angular/platform-browser';
|
|
||||||
import { APP_BASE_HREF } from '@angular/common';
|
import { APP_BASE_HREF } from '@angular/common';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { ComponentFixture, fakeAsync, flushMicrotasks, inject, TestBed, tick } from '@angular/core/testing';
|
||||||
import { MatProgressBar } from '@angular/material/progress-bar';
|
import { MatProgressBar } from '@angular/material/progress-bar';
|
||||||
import { MatSidenav } from '@angular/material/sidenav';
|
import { MatSidenav } from '@angular/material/sidenav';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By, Title } from '@angular/platform-browser';
|
||||||
|
import { ElementsLoader } from 'app/custom-elements/elements-loader';
|
||||||
import { Subject, of, timer } from 'rxjs';
|
|
||||||
import { first, mapTo } from 'rxjs/operators';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
import { AppModule } from './app.module';
|
|
||||||
import { CurrentNodes } from 'app/navigation/navigation.model';
|
|
||||||
import { DocumentService } from 'app/documents/document.service';
|
import { DocumentService } from 'app/documents/document.service';
|
||||||
import { DocViewerComponent } from 'app/layout/doc-viewer/doc-viewer.component';
|
import { DocViewerComponent } from 'app/layout/doc-viewer/doc-viewer.component';
|
||||||
|
import { CurrentNodes } from 'app/navigation/navigation.model';
|
||||||
|
import { NavigationNode, NavigationService } from 'app/navigation/navigation.service';
|
||||||
|
import { SearchBoxComponent } from 'app/search/search-box/search-box.component';
|
||||||
|
import { SearchService } from 'app/search/search.service';
|
||||||
import { Deployment } from 'app/shared/deployment.service';
|
import { Deployment } from 'app/shared/deployment.service';
|
||||||
import { ElementsLoader } from 'app/custom-elements/elements-loader';
|
|
||||||
import { GaService } from 'app/shared/ga.service';
|
import { GaService } from 'app/shared/ga.service';
|
||||||
import { LocationService } from 'app/shared/location.service';
|
import { LocationService } from 'app/shared/location.service';
|
||||||
import { Logger } from 'app/shared/logger.service';
|
import { Logger } from 'app/shared/logger.service';
|
||||||
|
import { ScrollService } from 'app/shared/scroll.service';
|
||||||
|
import { SearchResultsComponent } from 'app/shared/search-results/search-results.component';
|
||||||
|
import { SelectComponent } from 'app/shared/select/select.component';
|
||||||
|
import { TocItem, TocService } from 'app/shared/toc.service';
|
||||||
|
import { of, Subject, timer } from 'rxjs';
|
||||||
|
import { first, mapTo } from 'rxjs/operators';
|
||||||
import { MockLocationService } from 'testing/location.service';
|
import { MockLocationService } from 'testing/location.service';
|
||||||
import { MockLogger } from 'testing/logger.service';
|
import { MockLogger } from 'testing/logger.service';
|
||||||
import { MockSearchService } from 'testing/search.service';
|
import { MockSearchService } from 'testing/search.service';
|
||||||
import { NavigationNode, NavigationService } from 'app/navigation/navigation.service';
|
import { AppComponent } from './app.component';
|
||||||
import { ScrollService } from 'app/shared/scroll.service';
|
import { AppModule } from './app.module';
|
||||||
import { SearchBoxComponent } from 'app/search/search-box/search-box.component';
|
|
||||||
import { SearchResultsComponent } from 'app/shared/search-results/search-results.component';
|
|
||||||
import { SearchService } from 'app/search/search.service';
|
|
||||||
import { SelectComponent } from 'app/shared/select/select.component';
|
|
||||||
import { TocItem, TocService } from 'app/shared/toc.service';
|
|
||||||
|
|
||||||
const sideBySideBreakPoint = 992;
|
const sideBySideBreakPoint = 992;
|
||||||
const hideToCBreakPoint = 800;
|
const hideToCBreakPoint = 800;
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
import { Component, ElementRef, HostBinding, HostListener, OnInit,
|
import { Component, ElementRef, HostBinding, HostListener, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core';
|
||||||
QueryList, ViewChild, ViewChildren } from '@angular/core';
|
|
||||||
import { MatSidenav } from '@angular/material/sidenav';
|
import { MatSidenav } from '@angular/material/sidenav';
|
||||||
|
import { DocumentContents, DocumentService } from 'app/documents/document.service';
|
||||||
import { CurrentNodes, NavigationService, NavigationNode, VersionInfo } from 'app/navigation/navigation.service';
|
import { NotificationComponent } from 'app/layout/notification/notification.component';
|
||||||
import { DocumentService, DocumentContents } from 'app/documents/document.service';
|
import { CurrentNodes, NavigationNode, NavigationService, VersionInfo } from 'app/navigation/navigation.service';
|
||||||
|
import { SearchResults } from 'app/search/interfaces';
|
||||||
|
import { SearchBoxComponent } from 'app/search/search-box/search-box.component';
|
||||||
|
import { SearchService } from 'app/search/search.service';
|
||||||
import { Deployment } from 'app/shared/deployment.service';
|
import { Deployment } from 'app/shared/deployment.service';
|
||||||
import { LocationService } from 'app/shared/location.service';
|
import { LocationService } from 'app/shared/location.service';
|
||||||
import { NotificationComponent } from 'app/layout/notification/notification.component';
|
|
||||||
import { ScrollService } from 'app/shared/scroll.service';
|
import { ScrollService } from 'app/shared/scroll.service';
|
||||||
import { SearchBoxComponent } from 'app/search/search-box/search-box.component';
|
|
||||||
import { SearchResults } from 'app/search/interfaces';
|
|
||||||
import { SearchService } from 'app/search/search.service';
|
|
||||||
import { TocService } from 'app/shared/toc.service';
|
import { TocService } from 'app/shared/toc.service';
|
||||||
|
|
||||||
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
||||||
import { first, map } from 'rxjs/operators';
|
import { first, map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
@ -150,27 +147,27 @@ export class AppComponent implements OnInit {
|
||||||
this.navigationService.versionInfo,
|
this.navigationService.versionInfo,
|
||||||
this.navigationService.navigationViews.pipe(map(views => views['docVersions'])),
|
this.navigationService.navigationViews.pipe(map(views => views['docVersions'])),
|
||||||
]).subscribe(([versionInfo, versions]) => {
|
]).subscribe(([versionInfo, versions]) => {
|
||||||
// TODO(pbd): consider whether we can lookup the stable and next versions from the internet
|
// TODO(pbd): consider whether we can lookup the stable and next versions from the internet
|
||||||
const computedVersions: NavigationNode[] = [
|
const computedVersions: NavigationNode[] = [
|
||||||
{ title: 'next', url: 'https://next.angular.io' },
|
{ title: 'next', url: 'https://next.angular.io' },
|
||||||
{ title: 'stable', url: 'https://angular.io' },
|
{ title: 'stable', url: 'https://angular.io' },
|
||||||
];
|
];
|
||||||
if (this.deployment.mode === 'archive') {
|
if (this.deployment.mode === 'archive') {
|
||||||
computedVersions.push({ title: `v${versionInfo.major}` });
|
computedVersions.push({ title: `v${versionInfo.major}` });
|
||||||
}
|
}
|
||||||
this.docVersions = [...computedVersions, ...versions];
|
this.docVersions = [...computedVersions, ...versions];
|
||||||
|
|
||||||
// Find the current version - eithers title matches the current deployment mode
|
// Find the current version - eithers title matches the current deployment mode
|
||||||
// or its title matches the major version of the current version info
|
// or its title matches the major version of the current version info
|
||||||
this.currentDocVersion = this.docVersions.find(version =>
|
this.currentDocVersion = this.docVersions.find(version =>
|
||||||
version.title === this.deployment.mode || version.title === `v${versionInfo.major}`)!;
|
version.title === this.deployment.mode || version.title === `v${versionInfo.major}`)!;
|
||||||
this.currentDocVersion.title += ` (v${versionInfo.raw})`;
|
this.currentDocVersion.title += ` (v${versionInfo.raw})`;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.navigationService.navigationViews.subscribe(views => {
|
this.navigationService.navigationViews.subscribe(views => {
|
||||||
this.footerNodes = views['Footer'] || [];
|
this.footerNodes = views['Footer'] || [];
|
||||||
this.sideNavNodes = views['SideNav'] || [];
|
this.sideNavNodes = views['SideNav'] || [];
|
||||||
this.topMenuNodes = views['TopBar'] || [];
|
this.topMenuNodes = views['TopBar'] || [];
|
||||||
this.topMenuNarrowNodes = views['TopBarNarrow'] || this.topMenuNodes;
|
this.topMenuNarrowNodes = views['TopBarNarrow'] || this.topMenuNodes;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -267,7 +264,7 @@ export class AppComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deal with anchor clicks; climb DOM tree until anchor found (or null)
|
// Deal with anchor clicks; climb DOM tree until anchor found (or null)
|
||||||
let target: HTMLElement|null = eventTarget;
|
let target: HTMLElement | null = eventTarget;
|
||||||
while (target && !(target instanceof HTMLAnchorElement)) {
|
while (target && !(target instanceof HTMLAnchorElement)) {
|
||||||
target = target.parentElement;
|
target = target.parentElement;
|
||||||
}
|
}
|
||||||
|
@ -410,7 +407,7 @@ export class AppComponent implements OnInit {
|
||||||
if (key === '/' || keyCode === 191) {
|
if (key === '/' || keyCode === 191) {
|
||||||
this.focusSearchBox();
|
this.focusSearchBox();
|
||||||
}
|
}
|
||||||
if (key === 'Escape' || keyCode === 27 ) {
|
if (key === 'Escape' || keyCode === 27) {
|
||||||
// escape key
|
// escape key
|
||||||
if (this.showSearchResults) {
|
if (this.showSearchResults) {
|
||||||
this.hideSearchResults();
|
this.hideSearchResults();
|
||||||
|
|
Loading…
Reference in New Issue