Skip to content

Commit

Permalink
Repeat last spoken sentence with redo
Browse files Browse the repository at this point in the history
  • Loading branch information
RodriSanchez1 committed Dec 4, 2023
1 parent 84bd15a commit 07ab0fa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/Board/Output/Output.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ export class OutputContainer extends Component {
this.spliceOutput(index);
};

handleRepeatLastSpokenSentence() {
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();
Expand All @@ -228,6 +237,11 @@ export class OutputContainer extends Component {
};

handleOutputKeyDown = event => {
if (event.ctrlKey && event.nativeEvent.shiftKey && keycode('Z')) {
this.handleRepeatLastSpokenSentence();
return;
}

if (event.keyCode === keycode('enter')) {
const targetEl = event.target;
if (targetEl.tagName.toLowerCase() === 'div') {
Expand Down

0 comments on commit 07ab0fa

Please sign in to comment.