From f56bc4808ef62068f60d8871e674100340d32395 Mon Sep 17 00:00:00 2001 From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr> Date: Wed, 25 Jan 2023 15:36:16 +0100 Subject: [PATCH] WIP opening side to side. Adding Resource ok --- src/components/CanvasAnnotations.js | 18 +++++++++++++++++- src/containers/CanvasAnnotations.js | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/components/CanvasAnnotations.js b/src/components/CanvasAnnotations.js index 6b8e4e87b..0dd39e3a0 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 15c7479f4..60b1bf99a 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, -- GitLab