mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Ensure that the editor state is preserved when switching views (#17238)
GitOrigin-RevId: 946b82cb633afbea13a72e30a9ce432aa1a8196d
This commit is contained in:
@@ -10,12 +10,10 @@ import { HistorySidebar } from '@/features/ide-react/components/history-sidebar'
|
||||
import { HistoryProvider } from '@/features/history/context/history-context'
|
||||
import History from '@/features/ide-react/components/history'
|
||||
import EditorSidebar from '@/features/ide-react/components/editor-sidebar'
|
||||
import { EditorPane } from '@/features/ide-react/components/editor/editor-pane'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSidebarPane } from '@/features/ide-react/hooks/use-sidebar-pane'
|
||||
import { useChatPane } from '@/features/ide-react/hooks/use-chat-pane'
|
||||
import { EditorAndPdf } from '@/features/ide-react/components/editor-and-pdf'
|
||||
import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context'
|
||||
|
||||
export const MainLayout: FC = () => {
|
||||
const { view } = useLayoutContext()
|
||||
@@ -41,13 +39,8 @@ export const MainLayout: FC = () => {
|
||||
handlePaneExpand: handleChatExpand,
|
||||
} = useChatPane()
|
||||
|
||||
const { currentDocumentId } = useEditorManagerContext()
|
||||
|
||||
const { t } = useTranslation()
|
||||
|
||||
// keep the editor pane open when a doc is open, even if the history view is open
|
||||
const editorPane = currentDocumentId ? <EditorPane /> : null
|
||||
|
||||
return (
|
||||
<div className="ide-react-main">
|
||||
<EditorNavigationToolbar />
|
||||
@@ -93,13 +86,12 @@ export const MainLayout: FC = () => {
|
||||
<Panel id="panel-outer-main" order={2}>
|
||||
<PanelGroup autoSaveId="ide-inner-layout" direction="horizontal">
|
||||
<Panel className="ide-react-panel" id="panel-main" order={1}>
|
||||
{view === 'history' ? (
|
||||
{view === 'history' && (
|
||||
<HistoryProvider>
|
||||
<History />
|
||||
</HistoryProvider>
|
||||
) : (
|
||||
<EditorAndPdf editorPane={editorPane} />
|
||||
)}
|
||||
<EditorAndPdf />
|
||||
</Panel>
|
||||
|
||||
<HorizontalResizeHandle
|
||||
|
||||
Reference in New Issue
Block a user