import React, { Component } from 'react' import { Route } from 'react-router-dom' import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import actions from 'app/actions' import ParagraphForm from '../components/paragraph.form' import ParagraphList from '../components/paragraph.list' import { paragraphElementLookup } from '../components/paragraphTypes' class ParagraphEditor extends Component { state = { selectedParagraph: null, selectedParagraphOffset: 0, } constructor(props) { super(props) this.handleAnnotationClick = this.handleAnnotationClick.bind(this) this.handleParagraphDoubleClick = this.handleParagraphDoubleClick.bind(this) this.handleCloseParagraphForm = this.handleCloseParagraphForm.bind(this) this.updateSelectedParagraph = this.updateSelectedParagraph.bind(this) } handleAnnotationClick(e, paragraph, annotation){ actions.audio.seek(annotation.start_ts) } handleParagraphDoubleClick(e, paragraph) { console.log(e.target.parentNode) let paragraphNode = e.target if (!paragraphNode.classList.contains('paragraph')) { paragraphNode = paragraphNode.parentNode } this.setState({ selectedParagraph: { ...paragraph }, selectedParagraphOffset: paragraphNode.offsetTop }) } updateSelectedParagraph(selectedParagraph) { this.setState({ selectedParagraph }) } handleCloseParagraphForm() { this.setState({ selectedParagraph: null }) } render() { // const { media } = this.props const { paragraphs, selectedParagraph, currentParagraph, currentAnnotation } = this.state return (