Files
overleaf-cep/services/web/frontend/js/features/ide-react/hooks/use-outline-pane.ts
T
David 075e18c7c8 Merge pull request #27384 from overleaf/dp-drag-file-tree-outline
Allow file tree and outline to be expandable and collapsible by dragging

GitOrigin-RevId: e25f0d263b1446537cdb42ef52fe1c486e855773
2025-08-06 08:05:09 +00:00

22 lines
695 B
TypeScript

import { useOutlineContext } from '@/features/ide-react/context/outline-context'
import useCollapsiblePanel from '@/features/ide-react/hooks/use-collapsible-panel'
import { useRef } from 'react'
import { ImperativePanelHandle } from 'react-resizable-panels'
export const useOutlinePane = () => {
const { canShowOutline, outlineExpanded, expandOutline, collapseOutline } =
useOutlineContext()
const outlinePanelRef = useRef<ImperativePanelHandle>(null)
const outlineEnabled = canShowOutline && outlineExpanded
useCollapsiblePanel(outlineEnabled, outlinePanelRef)
return {
outlineEnabled,
canShowOutline,
outlinePanelRef,
expandOutline,
collapseOutline,
}
}