mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #25514 from overleaf/mj-ide-pdf-controls-editor-only
[web] Hide PDF controls from menu bar in editor only mode GitOrigin-RevId: 91513e40693e1214c3bdbc56d9dec19e08c74e36
This commit is contained in:
committed by
Copybot
parent
21c035b8d5
commit
587390d066
@@ -8,6 +8,7 @@ import PdfViewerControlsMenuButton from './pdf-viewer-controls-menu-button'
|
||||
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
|
||||
import { useCommandProvider } from '@/features/ide-react/hooks/use-command-provider'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
||||
|
||||
type PdfViewerControlsToolbarProps = {
|
||||
requestPresentationMode: () => void
|
||||
@@ -44,8 +45,15 @@ function PdfViewerControlsToolbar({
|
||||
|
||||
const { elementRef: pdfControlsRef } = useResizeObserver(handleResize)
|
||||
|
||||
useCommandProvider(
|
||||
() => [
|
||||
const { view: ideView, pdfLayout } = useLayoutContext()
|
||||
const editorOnly = ideView !== 'pdf' && pdfLayout === 'flat'
|
||||
|
||||
useCommandProvider(() => {
|
||||
if (editorOnly) {
|
||||
return
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
id: 'view-pdf-presentation-mode',
|
||||
label: t('presentation_mode'),
|
||||
@@ -71,9 +79,8 @@ function PdfViewerControlsToolbar({
|
||||
label: t('fit_to_height'),
|
||||
handler: () => setZoom('page-height'),
|
||||
},
|
||||
],
|
||||
[t, requestPresentationMode, setZoom]
|
||||
)
|
||||
]
|
||||
}, [t, requestPresentationMode, setZoom, editorOnly])
|
||||
|
||||
if (!toolbarControlsElement) {
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user