mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Only show compile shortcut when editor is visible (#7773)
GitOrigin-RevId: 0b6d25d7012e82a676e3a782730fb6ca481cd1e8
This commit is contained in:
parent
e5051bcd1d
commit
ff44afb74c
1 changed files with 7 additions and 2 deletions
|
@ -8,12 +8,17 @@ import { useLayoutContext } from '../../../shared/context/layout-context'
|
|||
const modifierKey = /Mac/i.test(navigator.platform) ? 'Cmd' : 'Ctrl'
|
||||
|
||||
function PdfCompileButtonInner({ startCompile, compiling }) {
|
||||
const { detachRole } = useLayoutContext()
|
||||
const { detachRole, view, pdfLayout } = useLayoutContext()
|
||||
|
||||
const { t } = useTranslation()
|
||||
|
||||
const compileButtonLabel = compiling ? t('compiling') + '…' : t('recompile')
|
||||
|
||||
// show the compile shortcut when the editor is visible
|
||||
const showCompileShortcut =
|
||||
detachRole !== 'detached' &&
|
||||
(view === 'editor' || pdfLayout === 'sideBySide')
|
||||
|
||||
return (
|
||||
<OverlayTrigger
|
||||
placement="bottom"
|
||||
|
@ -21,7 +26,7 @@ function PdfCompileButtonInner({ startCompile, compiling }) {
|
|||
overlay={
|
||||
<Tooltip id="tooltip-logs-toggle" className="keyboard-tooltip">
|
||||
{t('recompile_pdf')}{' '}
|
||||
{detachRole !== 'detached' && (
|
||||
{showCompileShortcut && (
|
||||
<span className="keyboard-shortcut">({modifierKey} + Enter)</span>
|
||||
)}
|
||||
</Tooltip>
|
||||
|
|
Loading…
Reference in a new issue