Merge pull request #19156 from overleaf/dp-fit-to-height-shortcut

Add fit to height shortcut to pdf controls

GitOrigin-RevId: 7b8c8da7e9e6cf829573ec6c5abab6355d898098
This commit is contained in:
David
2024-07-04 13:34:32 +01:00
committed by Copybot
parent 6bca4c951e
commit 2d0797d3bf
2 changed files with 8 additions and 0 deletions

View File

@@ -462,6 +462,11 @@ function PdfJsViewer({ url, pdfFile }: PdfJsViewerProps) {
event.preventDefault()
setZoom('page-width')
break
case '9':
event.preventDefault()
setZoom('page-height')
break
}
}
},

View File

@@ -12,11 +12,13 @@ const shortcuts = isMac
'zoom-in': ['⌘', '+'],
'zoom-out': ['⌘', '-'],
'fit-to-width': ['⌘', '0'],
'fit-to-height': ['⌘', '9'],
}
: {
'zoom-in': ['Ctrl', '+'],
'zoom-out': ['Ctrl', '-'],
'fit-to-width': ['Ctrl', '0'],
'fit-to-height': ['Ctrl', '9'],
}
type PdfZoomDropdownProps = {
@@ -121,6 +123,7 @@ function PdfZoomDropdown({
</MenuItem>
<MenuItem draggable={false} key="page-height" eventKey="page-height">
{t('fit_to_height')}
<Shortcut keys={shortcuts['fit-to-height']} />
</MenuItem>
{showPresentOption && <MenuItem divider />}
{showPresentOption && (