Skip to content
Snippets Groups Projects
Commit 06c94af7 authored by Johannes Baiter's avatar Johannes Baiter
Browse files

Add option to disable automatic canvas switching upon receiving search results.

This allows integrators to customize this behavior, e.g. by not
selecting the first, but another canvas via a custom saga.
The default is set to `true`, so there is no change in behavior
for integrators not setting this option.
parent f2376c91
No related branches found
No related tags found
No related merge requests found
...@@ -268,6 +268,7 @@ export default { ...@@ -268,6 +268,7 @@ export default {
highlightAllAnnotations: false, // Configure whether to display annotations on the canvas by default highlightAllAnnotations: false, // Configure whether to display annotations on the canvas by default
showLocalePicker: false, // Configure locale picker for multi-lingual metadata showLocalePicker: false, // Configure locale picker for multi-lingual metadata
sideBarOpen: false, // Configure if the sidebar (and its content panel) is open by default sideBarOpen: false, // Configure if the sidebar (and its content panel) is open by default
switchCanvasOnSearch: true, // Configure if Mirador should automatically switch to the canvas of the first search result
panels: { // Configure which panels are visible in WindowSideBarButtons panels: { // Configure which panels are visible in WindowSideBarButtons
info: true, info: true,
attribution: true, attribution: true,
......
...@@ -27,6 +27,7 @@ import { ...@@ -27,6 +27,7 @@ import {
getElasticLayout, getElasticLayout,
getCanvases, getCanvases,
selectInfoResponses, selectInfoResponses,
getWindowConfig,
} from '../selectors'; } from '../selectors';
import { fetchManifests } from './iiif'; import { fetchManifests } from './iiif';
...@@ -202,6 +203,10 @@ export function* updateVisibleCanvases({ windowId }) { ...@@ -202,6 +203,10 @@ export function* updateVisibleCanvases({ windowId }) {
/** @private */ /** @private */
export function* setCanvasOfFirstSearchResult({ companionWindowId, windowId }) { export function* setCanvasOfFirstSearchResult({ companionWindowId, windowId }) {
const { switchCanvasOnSearch } = yield select(getWindowConfig, { windowId });
if (!switchCanvasOnSearch) {
return;
}
const selectedIds = yield select(getSelectedContentSearchAnnotationIds, { const selectedIds = yield select(getSelectedContentSearchAnnotationIds, {
companionWindowId, windowId, companionWindowId, windowId,
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment