Skip to content
Open
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
14 changes: 13 additions & 1 deletion src/components/WordAlignerDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ function WordAlignerDialog({
}
} = alignmentSuggestionsManage; // type is TUseAlignmentSuggestionsReturn

useEffect(() => { // close dialog on Escape key
if (!showDialog) return;
const handleKeyDown = (e) => {
if (e.key === 'Escape') {
alignmentActions_?.cancelAlignment();
}
};
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, [showDialog, alignmentActions_]);

useEffect(() => {
if (shouldShowDialog_ !== showDialog) {
console.log(`WordAlignerDialog: alignment data changed shouldShowDialog_ ${shouldShowDialog_}`)
Expand Down Expand Up @@ -343,7 +354,7 @@ function WordAlignerDialog({
<Dialog
fullWidth={true}
maxWidth={'lg'}
onClose={() => {}}
onClose={() => alignmentActions_?.cancelAlignment()}
open={!!showDialog}
PaperComponent={PaperComponent}
bounds={bounds}
Expand Down Expand Up @@ -378,6 +389,7 @@ function WordAlignerDialog({
)
},
[
alignmentActions_,
contextId,
errorMessage,
showDialog,
Expand Down
Loading