Skip to content
Snippets Groups Projects
Select Git revision
  • 9ea8564d6fe6699e0c689b4c2eaf365aa390f9a8
  • master default protected
2 results

batch_unlizeXml.sh

Blame
  • CanvasAnnotations.js 4.94 KiB
    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import clsx from 'clsx';
    import Chip from '@material-ui/core/Chip';
    import MenuList from '@material-ui/core/MenuList';
    import MenuItem from '@material-ui/core/MenuItem';
    import ListItemText from '@material-ui/core/ListItemText';
    import Typography from '@material-ui/core/Typography';
    import SanitizedHtml from '../containers/SanitizedHtml';
    import { ScrollTo } from './ScrollTo';
    
    /**
     * CanvasAnnotations ~
    */
    export class CanvasAnnotations extends Component {
      /**
       * constructor -
       */
      constructor(props) {
        super(props);
    
        this.handleClick = this.handleClick.bind(this);
        this.handleAnnotationHover = this.handleAnnotationHover.bind(this);
        this.handleAnnotationBlur = this.handleAnnotationBlur.bind(this);
      }
    
      /**
       * Handle click event of an annotation.
      */
      handleClick(event, annotation) {
        const {
          deselectAnnotation, selectAnnotation, selectedAnnotationId, windowId,
        } = this.props;
    
        if (selectedAnnotationId === annotation.id) {
          deselectAnnotation(windowId, annotation.id);
        } else {
          selectAnnotation(windowId, annotation.id);
        }
      }
    
      /** */
      handleAnnotationHover(annotation) {
        const { hoverAnnotation, windowId } = this.props;
    
        hoverAnnotation(windowId, [annotation.id]);
      }
    
      /** */
      handleAnnotationBlur() {
        const { hoverAnnotation, windowId } = this.props;
    
        hoverAnnotation(windowId, []);
      }
    
      /**
       * Returns the rendered component
      */
      render() {
        const {
          annotations, classes, index, label, selectedAnnotationId, t, totalSize,
          listContainerComponent, htmlSanitizationRuleSet, hoveredAnnotationIds,
          containerRef,
        } = this.props;
        if (annotations.length === 0) return null;
    
        return (
          <>
            <Typography className={classes.sectionHeading} variant="overline">
              {t('annotationCanvasLabel', { context: `${index + 1}/${totalSize}`, label })}