diff --git a/src/components/Board/Output/Output.container.js b/src/components/Board/Output/Output.container.js index 059a9bfca..ea3b4827c 100644 --- a/src/components/Board/Output/Output.container.js +++ b/src/components/Board/Output/Output.container.js @@ -64,6 +64,16 @@ export class OutputContainer extends Component { translatedOutput: [] }; + componentDidMount() { + document.addEventListener('keydown', this.handleRepeatLastSpokenSentence); + } + componentWillUnmount() { + document.removeEventListener( + 'keydown', + this.handleRepeatLastSpokenSentence + ); + } + outputReducer(accumulator, currentValue) { const actionValue = currentValue.action && @@ -219,6 +229,22 @@ export class OutputContainer extends Component { this.spliceOutput(index); }; + handleRepeatLastSpokenSentence = event => { + const Z_KEY_CODE = 90; + const Y_KEY_CODE = 89; + if ( + (event.ctrlKey && event.shiftKey && event.keyCode === Z_KEY_CODE) || + (event.ctrlKey && event.keyCode === Y_KEY_CODE) + ) { + const { output } = this.props; + const lastSpokenSymbol = output.findLast( + (element, index) => element.label && index !== output.length - 1 + ); + const text = lastSpokenSymbol ? lastSpokenSymbol.label : ''; + this.speakOutput(text); + } + }; + handleOutputClick = event => { const targetEl = event.target; const targetElLow = targetEl.tagName.toLowerCase(); diff --git a/src/components/Board/Symbol/Symbol.css b/src/components/Board/Symbol/Symbol.css index 1d98e7442..259281d43 100644 --- a/src/components/Board/Symbol/Symbol.css +++ b/src/components/Board/Symbol/Symbol.css @@ -24,6 +24,10 @@ padding: 0.2em 0.9em 0.2em 0.9em; } +.liveInput .MuiInputBase-input::-webkit-scrollbar { + display: none; +} + .Symbol textarea { align-self: flex-start; font-weight: 700;