Skip to content

Commit

Permalink
Merged in DSC-1298-maintenance (pull request DSpace#1333)
Browse files Browse the repository at this point in the history
DSC-1298 maintenance

Approved-by: Francesco Molinaro
  • Loading branch information
Davide Negretti authored and FrancescoMolinaro committed Oct 10, 2024
2 parents 07494ad + e1141a5 commit d420678
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/app/item-page/mirador-viewer/mirador-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export class MiradorViewerComponent implements OnInit {
*/
@Input() searchable: boolean;

/**
* Is used as canvas identifier of the element to show.
*/
@Input() canvasId: string;

/**
* Hides embedded viewer in dev mode.
*/
Expand Down Expand Up @@ -90,6 +95,9 @@ export class MiradorViewerComponent implements OnInit {
if (environment.mirador.enableDownloadPlugin) {
viewerPath += '&enableDownloadPlugin=true';
}
if (this.canvasId) {
viewerPath += `&canvasId=${this.canvasId}`;
}

// TODO: Should the query term be trusted here?
return this.sanitizer.bypassSecurityTrustResourceUrl(viewerPath);
Expand Down
23 changes: 15 additions & 8 deletions src/mirador-viewer/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import miradorSharePlugin from 'mirador-share-plugin/es/miradorSharePlugin';
import miradorDownloadPlugin from 'mirador-dl-plugin/es/miradorDownloadPlugin';
import miradorDownloadDialog from 'mirador-dl-plugin/es/MiradorDownloadDialog';

const MANIFEST_URL_PART = /\/manifest$/;

const embedURL = location.href;
const params = new URLSearchParams(location.search);
const manifest = params.get('manifest');
Expand All @@ -25,6 +27,7 @@ const query = params.get('query');
const multi = params.get('multi');
const notMobile = params.get('notMobile');
const isDownloadPluginEnabled = (params.get('enableDownloadPlugin') === 'true');
const canvasId = params.get('canvasId');

let windowSettings = {};
let sideBarPanel = 'info';
Expand Down Expand Up @@ -56,6 +59,10 @@ windowSettings.manifestId = manifest;
}
}
}
if (canvasId && canvasId !== 'null') {
windowSettings.canvasId =
`${(manifest.replace(MANIFEST_URL_PART, ''))}/canvas/${canvasId}`;
}
})();

let miradorConfiguration = {
Expand All @@ -64,7 +71,7 @@ let miradorConfiguration = {
show: true
},
thumbnailNavigation: {
defaultPosition: thumbNavigation, // Which position for the thumbnail navigation to be be displayed. Other possible values are "far-bottom" or "far-right"
defaultPosition: thumbNavigation, // Which position for the thumbnail navigation to be displayed. Other possible values are "far-bottom" or "far-right"
displaySettings: true, // Display the settings for this in WindowTopMenu
height: 120, // height of entire ThumbnailNavigation area when position is "far-bottom"
width: 100, // width of one canvas (doubled for book view) in ThumbnailNavigation area when position is "far-right"
Expand All @@ -89,9 +96,9 @@ let miradorConfiguration = {
secondary: '#00BFFF',
},
search: {
default: { fillStyle: '#00BFFF', globalAlpha: 0.3 },
hovered: { fillStyle: '#00FFFF', globalAlpha: 0.3 },
selected: { fillStyle: '#ff0900', globalAlpha: 0.3 },
default: {fillStyle: '#00BFFF', globalAlpha: 0.3},
hovered: {fillStyle: '#00FFFF', globalAlpha: 0.3},
selected: {fillStyle: '#ff0900', globalAlpha: 0.3},
},
},
},
Expand Down Expand Up @@ -147,10 +154,10 @@ let miradorConfiguration = {
defaultSidebarPanelWidth: 230,
switchCanvasOnSearch: true,
views: [
{ key: 'single', behaviors: ['individuals'] },
{ key: 'book', behaviors: ['paged'] },
{ key: 'scroll', behaviors: ['continuous'] },
{ key: 'gallery' },
{key: 'single', behaviors: ['individuals']},
{key: 'book', behaviors: ['paged']},
{key: 'scroll', behaviors: ['continuous']},
{key: 'gallery'},
],
panels: {
info: true,
Expand Down

0 comments on commit d420678

Please sign in to comment.