Skip to content

Commit

Permalink
Fix(reader): enable reader keyboard shortcut on publication info close
Browse files Browse the repository at this point in the history
keyboard shortcut not enabled after closing publication info modal

Fixes #2023
  • Loading branch information
panaC committed Nov 6, 2023
1 parent 0318e81 commit b2b41b6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/renderer/reader/components/Reader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,12 @@ class Reader extends React.Component<IProps, IState> {
this.unregisterAllKeyboardListeners();
this.registerAllKeyboardListeners();
}

if (oldProps.infoOpen === true && this.props.infoOpen === false) { // close
this.setState({shortcutEnable: true});
} else if (oldProps.infoOpen === false && this.props.infoOpen === true) { // open
this.setState({shortcutEnable: false});
}
}

public componentWillUnmount() {
Expand Down Expand Up @@ -1479,13 +1485,6 @@ class Reader extends React.Component<IProps, IState> {

private displayPublicationInfo(focusWhereAmI?: boolean) {
if (this.props.publicationView) {
// TODO: subscribe to Redux action type == CloseRequest
// in order to reset shortcutEnable to true? Problem: must be specific to this reader window.
// So instead we subscribe to DOM event "Thorium:DialogClose", but this is a short-term hack!
this.setState({
shortcutEnable: false,
});

const readerReadingLocation = this.state.currentLocation ? this.state.currentLocation : undefined;
this.props.displayPublicationInfo(this.props.publicationView.identifier, this.state.pdfPlayerNumberOfPages, this.state.divinaNumberOfPages, this.state.divinaContinousEqualTrue, readerReadingLocation, this.handleLinkUrl.bind(this), focusWhereAmI);
}
Expand Down

0 comments on commit b2b41b6

Please sign in to comment.