mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 06:39:02 +02:00
075e18c7c8
Allow file tree and outline to be expandable and collapsible by dragging GitOrigin-RevId: e25f0d263b1446537cdb42ef52fe1c486e855773
22 lines
695 B
TypeScript
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,
|
|
}
|
|
}
|