From 9253dac12f870e8eb102ebc1edd1ac8ae74fd46e Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Mon, 23 May 2022 12:59:08 +0100 Subject: [PATCH] Merge pull request #8010 from overleaf/ta-synctex-unmount Unmount Default Synctex Controls in Detacher Mode GitOrigin-RevId: bc754fb172aba7430003f7a61eddb4450b175025 --- .../pdf-preview/components/detach-synctex-control.js | 8 ++++++++ .../pdf-preview/controllers/pdf-preview-controller.js | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/services/web/frontend/js/features/pdf-preview/components/detach-synctex-control.js b/services/web/frontend/js/features/pdf-preview/components/detach-synctex-control.js index 74bfc62183..812b342e39 100644 --- a/services/web/frontend/js/features/pdf-preview/components/detach-synctex-control.js +++ b/services/web/frontend/js/features/pdf-preview/components/detach-synctex-control.js @@ -2,6 +2,14 @@ import PropTypes from 'prop-types' import { useLayoutContext } from '../../../shared/context/layout-context' import PdfSynctexControls from './pdf-synctex-controls' +export function DefaultSynctexControl() { + const { detachRole } = useLayoutContext(layoutContextPropTypes) + if (!detachRole) { + return + } + return null +} + export function DetacherSynctexControl() { const { detachRole, detachIsLinked } = useLayoutContext( layoutContextPropTypes diff --git a/services/web/frontend/js/features/pdf-preview/controllers/pdf-preview-controller.js b/services/web/frontend/js/features/pdf-preview/controllers/pdf-preview-controller.js index f64eb05dde..e3d2fae4b1 100644 --- a/services/web/frontend/js/features/pdf-preview/controllers/pdf-preview-controller.js +++ b/services/web/frontend/js/features/pdf-preview/controllers/pdf-preview-controller.js @@ -3,13 +3,15 @@ import { react2angular } from 'react2angular' import PdfPreview from '../components/pdf-preview' import { rootContext } from '../../../shared/context/root-context' -import PdfSynctexControls from '../components/pdf-synctex-controls' -import { DetacherSynctexControl } from '../components/detach-synctex-control' +import { + DefaultSynctexControl, + DetacherSynctexControl, +} from '../components/detach-synctex-control' App.component('pdfPreview', react2angular(rootContext.use(PdfPreview), [])) App.component( 'pdfSynctexControls', - react2angular(rootContext.use(PdfSynctexControls), []) + react2angular(rootContext.use(DefaultSynctexControl), []) ) App.component( 'detacherSynctexControl',