mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 14:49:01 +02:00
18c2b4108d
* Remove crypto from window * Remove ui.loadingStyleSheet * Remove onlineUsers scope * Remove addNewComment GitOrigin-RevId: 5e62ed7f265cdd530b5ca85488477093b0be775a
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { LoadingPane } from '@/features/ide-react/components/editor/loading-pane'
|
|
import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context'
|
|
import { EditorScopeValue } from '@/features/ide-react/scope-adapters/editor-manager-context-adapter'
|
|
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>
|
|
)
|
|
}
|