mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 23:13:04 +00:00
Viewer updates.
This commit is contained in:
@@ -16,6 +16,7 @@ import { of } from 'rxjs';
|
|||||||
import { isPlatformBrowser } from '@angular/common';
|
import { isPlatformBrowser } from '@angular/common';
|
||||||
import { BitstreamFormat } from '../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../core/shared/bitstream-format.model';
|
||||||
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||||
|
import { HostWindowService } from '../../shared/host-window.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-mirador-viewer',
|
selector: 'ds-mirador-viewer',
|
||||||
@@ -27,14 +28,29 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
|
|
||||||
@Input() item: Item;
|
@Input() item: Item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A previous dspace search query.
|
||||||
|
*/
|
||||||
@Input() query: string;
|
@Input() query: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if searchable.
|
||||||
|
*/
|
||||||
@Input() searchable: boolean;
|
@Input() searchable: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The url for the iframe.
|
||||||
|
*/
|
||||||
iframeViewerUrl: Observable<SafeResourceUrl>;
|
iframeViewerUrl: Observable<SafeResourceUrl>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the viewer to show or hide thumbnail side navigation menu.
|
||||||
|
*/
|
||||||
multi = false;
|
multi = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the thumbnail navigation menu on smaller viewports.
|
||||||
|
*/
|
||||||
notMobile = false;
|
notMobile = false;
|
||||||
|
|
||||||
LINKS_TO_FOLLOW: FollowLinkConfig<Bitstream>[] = [
|
LINKS_TO_FOLLOW: FollowLinkConfig<Bitstream>[] = [
|
||||||
@@ -43,6 +59,7 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private sanitizer: DomSanitizer,
|
constructor(private sanitizer: DomSanitizer,
|
||||||
private bitstreamDataService: BitstreamDataService,
|
private bitstreamDataService: BitstreamDataService,
|
||||||
|
private windowService: HostWindowService,
|
||||||
@Inject(PLATFORM_ID) private platformId: any) {
|
@Inject(PLATFORM_ID) private platformId: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,15 +97,14 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
* Initializes the iframe url observable.
|
* Initializes the iframe url observable.
|
||||||
*/
|
*/
|
||||||
if (isPlatformBrowser(this.platformId)) {
|
if (isPlatformBrowser(this.platformId)) {
|
||||||
// This will not be responsive to resizing.
|
// The notMobile property affects only the thumbnail navigation
|
||||||
if (window.innerWidth > 768) {
|
// menu by hiding it for smaller viewports. This will not be
|
||||||
this.notMobile = true;
|
// responsive to resizing.
|
||||||
}
|
this.windowService.isMd().subscribe((s) => this.notMobile = s);
|
||||||
|
|
||||||
// We need to set the multi property to true if the
|
// We need to set the multi property to true if the
|
||||||
// item is searchable or the ORIGINAL bundle contains more
|
// item is searchable or the ORIGINAL bundle contains more
|
||||||
// than 1 image bitstream. The multi property controls the
|
// than 1 image bitstream. The multi property determine whether the
|
||||||
// Mirador side navigation panel.
|
// Mirador side navigation panel is shown.
|
||||||
if (this.searchable) {
|
if (this.searchable) {
|
||||||
// If it's searchable set multi to true.
|
// If it's searchable set multi to true.
|
||||||
const observable = of({multi: true});
|
const observable = of({multi: true});
|
||||||
|
@@ -21,9 +21,7 @@ export const isIiifSearchEnabled = (item: Item) => {
|
|||||||
* @param routeService
|
* @param routeService
|
||||||
*/
|
*/
|
||||||
export const getDSpaceQuery = (item: Item, routeService: RouteService): Observable<string> => {
|
export const getDSpaceQuery = (item: Item, routeService: RouteService): Observable<string> => {
|
||||||
return routeService.getHistory().pipe(
|
return routeService.getPreviousUrl().pipe(
|
||||||
take(1),
|
|
||||||
map(routes => routes[routes.length - 2 ]),
|
|
||||||
filter(r => {
|
filter(r => {
|
||||||
return r.includes('/search');
|
return r.includes('/search');
|
||||||
}),
|
}),
|
||||||
|
@@ -21,10 +21,19 @@ export class ItemComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
itemPageRoute: string;
|
itemPageRoute: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the mirador component.
|
||||||
|
*/
|
||||||
iiifEnabled: boolean;
|
iiifEnabled: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to configure search in mirador.
|
||||||
|
*/
|
||||||
iiifSearchEnabled: boolean;
|
iiifSearchEnabled: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The query term from the previous dspace search.
|
||||||
|
*/
|
||||||
iiifQuery$: Observable<string>;
|
iiifQuery$: Observable<string>;
|
||||||
|
|
||||||
mediaViewer = environment.mediaViewer;
|
mediaViewer = environment.mediaViewer;
|
||||||
|
Reference in New Issue
Block a user