From 80bc58f304de7cc4d9c1664694df8f78b8d890c3 Mon Sep 17 00:00:00 2001 From: Chris Beer <cabeer@stanford.edu> Date: Sat, 20 Jun 2020 16:40:27 -0700 Subject: [PATCH] Add some plugin hooks --- .../WindowCanvasNavigationControls.test.js | 2 + src/components/AttributionPanel.js | 4 +- src/components/CanvasInfo.js | 45 +++++++++---------- src/components/ManifestInfo.js | 4 +- src/components/ManifestRelatedLinks.js | 3 +- .../WindowCanvasNavigationControls.js | 3 ++ src/components/WorkspaceAdd.js | 2 + 7 files changed, 37 insertions(+), 26 deletions(-) diff --git a/__tests__/src/components/WindowCanvasNavigationControls.test.js b/__tests__/src/components/WindowCanvasNavigationControls.test.js index a5c1267f3..d58e44f86 100644 --- a/__tests__/src/components/WindowCanvasNavigationControls.test.js +++ b/__tests__/src/components/WindowCanvasNavigationControls.test.js @@ -5,6 +5,7 @@ import { WindowCanvasNavigationControls } from '../../../src/components/WindowCa import ViewerInfo from '../../../src/containers/ViewerInfo'; import ViewerNavigation from '../../../src/containers/ViewerNavigation'; import ZoomControls from '../../../src/containers/ZoomControls'; +import { PluginHook } from '../../../src/components/PluginHook'; /** create wrapper */ function createWrapper(props) { @@ -31,6 +32,7 @@ describe('WindowCanvasNavigationControls', () => { <ZoomControls zoomToWorld={zoomToWorld} /> <ViewerNavigation /> <ViewerInfo /> + <PluginHook /> </Paper>, )).toBe(true); }); diff --git a/src/components/AttributionPanel.js b/src/components/AttributionPanel.js index 87690bcaa..358798f54 100644 --- a/src/components/AttributionPanel.js +++ b/src/components/AttributionPanel.js @@ -7,7 +7,7 @@ import Img from 'react-image'; import CompanionWindow from '../containers/CompanionWindow'; import { LabelValueMetadata } from './LabelValueMetadata'; import ns from '../config/css-ns'; - +import { PluginHook } from './PluginHook'; /** * WindowSideBarInfoPanel @@ -68,6 +68,8 @@ export class AttributionPanel extends Component { /> </div> )} + + <PluginHook {...this.props} /> </CompanionWindow> ); } diff --git a/src/components/CanvasInfo.js b/src/components/CanvasInfo.js index cb3f05d11..ee94fab34 100644 --- a/src/components/CanvasInfo.js +++ b/src/components/CanvasInfo.js @@ -4,7 +4,7 @@ import Typography from '@material-ui/core/Typography'; import CollapsibleSection from '../containers/CollapsibleSection'; import SanitizedHtml from '../containers/SanitizedHtml'; import { LabelValueMetadata } from './LabelValueMetadata'; - +import { PluginHook } from './PluginHook'; /** * CanvasInfo @@ -30,30 +30,29 @@ export class CanvasInfo extends Component { id={`${id}-currentItem-${index}`} label={t('currentItem', { context: `${index + 1}/${totalSize}` })} > - <> - {canvasLabel && ( - <Typography - aria-labelledby={ - `${id}-currentItem-${index} ${id}-currentItem-${index}-heading` - } - id={`${id}-currentItem-${index}-heading`} - variant="h4" - component="h5" - > - {canvasLabel} - </Typography> - )} + {canvasLabel && ( + <Typography + aria-labelledby={ + `${id}-currentItem-${index} ${id}-currentItem-${index}-heading` + } + id={`${id}-currentItem-${index}-heading`} + variant="h4" + component="h5" + > + {canvasLabel} + </Typography> + )} - {canvasDescription && ( - <Typography variant="body1"> - <SanitizedHtml htmlString={canvasDescription} ruleSet="iiif" /> - </Typography> - )} + {canvasDescription && ( + <Typography variant="body1"> + <SanitizedHtml htmlString={canvasDescription} ruleSet="iiif" /> + </Typography> + )} - {canvasMetadata.length > 0 && ( - <LabelValueMetadata labelValuePairs={canvasMetadata} /> - )} - </> + {canvasMetadata.length > 0 && ( + <LabelValueMetadata labelValuePairs={canvasMetadata} /> + )} + <PluginHook {...this.props} /> </CollapsibleSection> ); } diff --git a/src/components/ManifestInfo.js b/src/components/ManifestInfo.js index 4fc1b749b..d597983c1 100644 --- a/src/components/ManifestInfo.js +++ b/src/components/ManifestInfo.js @@ -4,7 +4,7 @@ import Typography from '@material-ui/core/Typography'; import CollapsibleSection from '../containers/CollapsibleSection'; import SanitizedHtml from '../containers/SanitizedHtml'; import { LabelValueMetadata } from './LabelValueMetadata'; - +import { PluginHook } from './PluginHook'; /** * ManifestInfo @@ -48,6 +48,8 @@ export class ManifestInfo extends Component { {manifestMetadata.length > 0 && ( <LabelValueMetadata labelValuePairs={manifestMetadata} /> )} + + <PluginHook {...this.props} /> </CollapsibleSection> ); } diff --git a/src/components/ManifestRelatedLinks.js b/src/components/ManifestRelatedLinks.js index e837e1a3c..50d034e7b 100644 --- a/src/components/ManifestRelatedLinks.js +++ b/src/components/ManifestRelatedLinks.js @@ -5,7 +5,7 @@ import Link from '@material-ui/core/Link'; import classNames from 'classnames'; import CollapsibleSection from '../containers/CollapsibleSection'; import ns from '../config/css-ns'; - +import { PluginHook } from './PluginHook'; /** * ManifestRelatedLinks @@ -96,6 +96,7 @@ export class ManifestRelatedLinks extends Component { </> )} </dl> + <PluginHook {...this.props} /> </CollapsibleSection> ); } diff --git a/src/components/WindowCanvasNavigationControls.js b/src/components/WindowCanvasNavigationControls.js index 5008e7d19..f7f7752e1 100644 --- a/src/components/WindowCanvasNavigationControls.js +++ b/src/components/WindowCanvasNavigationControls.js @@ -6,6 +6,7 @@ import ZoomControls from '../containers/ZoomControls'; import ViewerInfo from '../containers/ViewerInfo'; import ViewerNavigation from '../containers/ViewerNavigation'; import ns from '../config/css-ns'; +import { PluginHook } from './PluginHook'; /** * Represents the viewer controls in the mirador workspace. @@ -48,6 +49,8 @@ export class WindowCanvasNavigationControls extends Component { /> <ViewerNavigation windowId={windowId} /> <ViewerInfo windowId={windowId} /> + + <PluginHook {...this.props} /> </Paper> ); } diff --git a/src/components/WorkspaceAdd.js b/src/components/WorkspaceAdd.js index 4174baf39..05cff8230 100644 --- a/src/components/WorkspaceAdd.js +++ b/src/components/WorkspaceAdd.js @@ -16,6 +16,7 @@ import ManifestForm from '../containers/ManifestForm'; import ManifestListItem from '../containers/ManifestListItem'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import { IIIFDropTarget } from './IIIFDropTarget'; +import { PluginHook } from './PluginHook'; /** * An area for managing manifests and adding them to workspace @@ -96,6 +97,7 @@ export class WorkspaceAdd extends React.Component { ) : ( <Paper className={classes.list}> <Typography variant="srOnly" component="h1">{t('miradorResources')}</Typography> + <PluginHook {...this.props} /> <List> {manifestList} </List> -- GitLab