diff --git a/src/components/CanvasAnnotations.js b/src/components/CanvasAnnotations.js index 6b8e4e87b9cf3ba60c00a237aa53a43a4a35db9d..0dd39e3a01bcd94da79067ffcb68178b872f6843 100644 --- a/src/components/CanvasAnnotations.js +++ b/src/components/CanvasAnnotations.js @@ -9,6 +9,8 @@ import Typography from '@material-ui/core/Typography'; import SanitizedHtml from '../containers/SanitizedHtml'; import { ScrollTo } from './ScrollTo'; + + /** * CanvasAnnotations ~ */ @@ -22,6 +24,7 @@ export class CanvasAnnotations extends Component { this.handleClick = this.handleClick.bind(this); this.handleAnnotationHover = this.handleAnnotationHover.bind(this); this.handleAnnotationBlur = this.handleAnnotationBlur.bind(this); + this.handleOpenManifestSideToSide = this.handleOpenManifestSideToSide.bind(this); } /** @@ -48,10 +51,17 @@ export class CanvasAnnotations extends Component { /** */ handleAnnotationBlur() { + console.log('handleAnnotationBlur'); const { hoverAnnotation, windowId } = this.props; - hoverAnnotation(windowId, []); } + handleOpenManifestSideToSide(annotation) { + console.log("open"); + let manifestId = 'https://preview.iiif.io/cookbook/master/recipe/0003-mvm-video/manifest.json' // For testing purposes + + const { addResource } = this.props; + addResource(manifestId); + } /** * Returns the rendered component @@ -108,6 +118,11 @@ export class CanvasAnnotations extends Component { )) } </div> + <div> + {annotation.format != 'application/json' && ( + <button onClick={e => this.handleOpenManifestSideToSide(e, annotation)}>Ouvrir le manifest</button> + )} + </div> </ListItemText> </MenuItem> </ScrollTo> @@ -120,6 +135,7 @@ export class CanvasAnnotations extends Component { } CanvasAnnotations.propTypes = { + addResource: PropTypes.func.isRequired, annotations: PropTypes.arrayOf( PropTypes.shape({ content: PropTypes.string.isRequired, diff --git a/src/containers/CanvasAnnotations.js b/src/containers/CanvasAnnotations.js index 15c7479f49e30f7919010509f8613b795076298c..60b1bf99a385757e3961a9ef5d3b7c9f412993ed 100644 --- a/src/containers/CanvasAnnotations.js +++ b/src/containers/CanvasAnnotations.js @@ -46,6 +46,8 @@ const mapStateToProps = (state, { canvasId, windowId }) => ({ * @private */ const mapDispatchToProps = { + addResource: actions.addResource, + addWindow: actions.addWindow, deselectAnnotation: actions.deselectAnnotation, hoverAnnotation: actions.hoverAnnotation, selectAnnotation: actions.selectAnnotation,