Files
overleaf-cep/services/web/frontend/js/features/ide-redesign/components/editor.tsx
T
David e70b3e8397 Merge pull request #23710 from overleaf/dp-remove-file-tree-workaround
Remove pre-filetree work around for new editor

GitOrigin-RevId: 7b34e4e298324ad217b603b48abbfbfa78d21804
2025-02-21 09:04:32 +00:00

37 lines
1.1 KiB
TypeScript

import { LoadingPane } from '@/features/ide-react/components/editor/loading-pane'
import {
EditorScopeValue,
useEditorManagerContext,
} from '@/features/ide-react/context/editor-manager-context'
import { useFileTreeOpenContext } from '@/features/ide-react/context/file-tree-open-context'
import useScopeValue from '@/shared/hooks/use-scope-value'
import classNames from 'classnames'
import SourceEditor from '@/features/source-editor/components/source-editor'
export const Editor = () => {
const [editor] = useScopeValue<EditorScopeValue>('editor')
const { selectedEntityCount, openEntity } = useFileTreeOpenContext()
const { currentDocumentId } = useEditorManagerContext()
if (!currentDocumentId) {
return null
}
const isLoading = Boolean(
(!editor.sharejs_doc || editor.opening) &&
!editor.error_state &&
editor.open_doc_id
)
return (
<div
className={classNames('ide-redesign-editor-content', {
hidden: openEntity?.type !== 'doc' || selectedEntityCount !== 1,
})}
>
<SourceEditor />
{isLoading && <LoadingPane />}
</div>
)
}