From 136efc89b1006990e99039c5320c31cd2f29425e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 17 Jul 2020 19:50:25 +0200 Subject: properly update display of annotation when adjusting time --- .../views/paragraph/components/paragraphTypes/index.js | 5 +++++ .../components/paragraphTypes/paragraphTypes.image.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 animism-align/frontend/views/paragraph/components/paragraphTypes/paragraphTypes.image.js (limited to 'animism-align/frontend/views/paragraph/components') diff --git a/animism-align/frontend/views/paragraph/components/paragraphTypes/index.js b/animism-align/frontend/views/paragraph/components/paragraphTypes/index.js index 04546f6..bf68ed0 100644 --- a/animism-align/frontend/views/paragraph/components/paragraphTypes/index.js +++ b/animism-align/frontend/views/paragraph/components/paragraphTypes/index.js @@ -8,10 +8,15 @@ import { MediaVideo } from './paragraphTypes.video' +import { + MediaImage +} from './paragraphTypes.image' + export const ParagraphElementLookup = { paragraph: React.memo(Paragraph), hidden: React.memo(Paragraph), blockquote: React.memo(Paragraph), header: React.memo(ParagraphHeader), video: React.memo(MediaVideo), + image: React.memo(MediaImage), } diff --git a/animism-align/frontend/views/paragraph/components/paragraphTypes/paragraphTypes.image.js b/animism-align/frontend/views/paragraph/components/paragraphTypes/paragraphTypes.image.js new file mode 100644 index 0000000..36c72e9 --- /dev/null +++ b/animism-align/frontend/views/paragraph/components/paragraphTypes/paragraphTypes.image.js @@ -0,0 +1,17 @@ +import React, { Component } from 'react' + +export const MediaImage = ({ paragraph, media, currentParagraph, currentAnnotation, onAnnotationClick, onDoubleClick }) => { + if (!media.lookup) return
+ const className = currentParagraph ? 'media image current' : 'media image' + const annotation = paragraph.annotations[0] + const item = media.lookup[annotation.settings.media_id] + if (!item) return
Media not found: {annotation.settings.media_id}
+ return ( +
onDoubleClick(e, paragraph)} + > + +
+ ) +} -- cgit v1.2.3-70-g09d2