src/speech.js
/**
	 * Update containsSelection state based on whether range is inside of root element; update selected chunk position if user-selected range.
	 */
Update containsSelection state based on whether range is inside of root element; update selected chunk position if user-selected range.
Update containsSelection state based on whether range is inside of root element ; update selected chunk position if user - selected range .
updateContainsSelectionState() {
		const selection = window.getSelection();
		if ( 0 !== selection.rangeCount ) {
			const range = selection.getRangeAt( 0 );
			const props = {
				containsSelection: false,
			};
			try {
				props.containsSelection = this.rootElement.contains( range.startContainer ) || this.rootElement.contains( range.endContainer );
			} catch ( e ) {
			}
			if ( this.state.playing && this.playbackAddedRange && ! equalRanges( range, this.playbackAddedRange ) ) {
				const chunkSelection = this.getChunkPositionFromRange( range );
				if ( chunkSelection ) {
					Object.assign( props, chunkSelection );
				}
			}
			this.setState( props );
		}
	}
updateContainsSelectionState ( ) { const selection = window . getSelection ( ) ; if ( 0 !== selection . rangeCount ) { const range = selection . getRangeAt ( 0 ) ; const props = { containsSelection : false , } ; try { props . containsSelection = this . rootElement . contains ( range . startContainer ) || this . rootElement . contains ( range . endContainer ) ; } catch ( e ) { } if ( this . state . playing && this . playbackAddedRange && ! equalRanges ( range , this . playbackAddedRange ) ) { const chunkSelection = this . getChunkPositionFromRange ( range ) ; if ( chunkSelection ) { Object . assign ( props , chunkSelection ) ; } } this . setState ( props ) ; } }
Update containsSelection state based on whether range is inside of root element; update selected chunk position if user-selected range.
Update containsSelection state based on whether range is inside of root element ; update selected chunk position if user - selected range .
// @todo Firefox Permission denied to access property "nodeType" // Firefox. // Move current playback to newly selected range if not added programmatically.