Skip to content

Commit

Permalink
fix menu handlers #22
Browse files Browse the repository at this point in the history
  • Loading branch information
zag committed Jan 8, 2022
1 parent 7edbdad commit b2d0ad7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/renderer/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,18 @@ const App = ()=>{
}

const togglePreviewMode = (e) => {
e.preventDefault()
console.log("tooflge")
Object.hasOwnProperty.call(e, 'preventDefault') && e.preventDefault();
setPreviewMode(!isPreviewMode)
}

Mousetrap.bindGlobal(['command+/'], togglePreviewMode )
Mousetrap.bindGlobal(['ctrl+s', 'command+s'], saveFileAction)
// make menu command listener
vmd.on('menu-file-save', saveFileAction)
vmd.on('view-preview-toggle', togglePreviewMode)

return () => {
Mousetrap.unbind(['ctrl+s', 'command+s'])
Mousetrap.unbind(['command+/'])
vmd.off('menu-file-save', saveFileAction)
vmd.off('view-preview-toggle', togglePreviewMode)
}

})
Expand Down

0 comments on commit b2d0ad7

Please sign in to comment.