detach-synctex-control.js 749 B

12345678910111213141516171819202122232425262728
  1. import PropTypes from 'prop-types'
  2. import { useLayoutContext } from '../../../shared/context/layout-context'
  3. import PdfSynctexControls from './pdf-synctex-controls'
  4. export function DetacherSynctexControl() {
  5. const { detachRole, detachIsLinked } = useLayoutContext(
  6. layoutContextPropTypes
  7. )
  8. if (detachRole === 'detacher' && detachIsLinked) {
  9. return <PdfSynctexControls />
  10. }
  11. return null
  12. }
  13. export function DetachedSynctexControl() {
  14. const { detachRole, detachIsLinked } = useLayoutContext(
  15. layoutContextPropTypes
  16. )
  17. if (detachRole === 'detached' && detachIsLinked) {
  18. return <PdfSynctexControls />
  19. }
  20. return null
  21. }
  22. const layoutContextPropTypes = {
  23. detachRole: PropTypes.string,
  24. detachIsLinked: PropTypes.bool,
  25. }