Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Fixes #659 Double Click for Word Audio #665

Merged
merged 3 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/components/Word/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ export default class Word extends React.Component {
return title;
}

handleWordClick = () => {
handleWordPlay = () => {
const { word } = this.props;
const audio = new Audio(word.audio.url); // eslint-disable-line

audio.play();
}

handleSegmentPlay = () => {
const { word, currentVerse, audioActions, audioPosition, isPlaying, isSearched } = this.props;

if (isSearched) {
Expand Down Expand Up @@ -60,7 +67,8 @@ export default class Word extends React.Component {
{ ...bindTooltip}
key={word.code}
id={id}
onClick={this.handleWordClick}
onDoubleClick={this.handleSegmentPlay}
onClick={this.handleWordPlay}
className={`${className} pointer`}
title={this.buildTooltip(word, tooltip)}
dangerouslySetInnerHTML={{ __html: word.code }}
Expand Down
1 change: 0 additions & 1 deletion src/types/wordType.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default PropTypes.shape({
lineNumber: PropTypes.number.isRequired,
pageNumber: PropTypes.number.isRequired,
position: PropTypes.number.isRequired,
resourceId: PropTypes.number.isRequired,
translation: PropTypes.shape({
languageName: PropTypes.string,
text: PropTypes.string
Expand Down