mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix: first page default mode (#2719)
Co-authored-by: tzhangchi <c@affine.pro>
(cherry picked from commit 05b73a59be)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import './page-detail-editor.css';
|
||||
|
||||
import { PageNotFoundError } from '@affine/env/constant';
|
||||
import {
|
||||
DEFAULT_HELLO_WORLD_PAGE_ID,
|
||||
PageNotFoundError,
|
||||
} from '@affine/env/constant';
|
||||
import { rootCurrentEditorAtom } from '@affine/workspace/atom';
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
@@ -61,7 +64,10 @@ const EditorWrapper = memo(function EditorWrapper({
|
||||
meta => meta.id === pageId
|
||||
);
|
||||
const currentMode =
|
||||
useAtomValue(workspacePreferredModeAtom)[pageId] ?? 'page';
|
||||
useAtomValue(workspacePreferredModeAtom)[pageId] ??
|
||||
DEFAULT_HELLO_WORLD_PAGE_ID === pageId
|
||||
? 'edgeless'
|
||||
: 'page';
|
||||
const setEditor = useSetAtom(rootCurrentEditorAtom);
|
||||
assertExists(meta);
|
||||
return (
|
||||
|
||||
@@ -301,7 +301,7 @@ export const WorkspaceLayoutInner: FC<PropsWithChildren> = ({ children }) => {
|
||||
//#region init workspace
|
||||
if (currentWorkspace.blockSuiteWorkspace.isEmpty) {
|
||||
// this is a new workspace, so we should redirect to the new page
|
||||
const pageId = nanoid();
|
||||
const pageId = DEFAULT_HELLO_WORLD_PAGE_ID;
|
||||
const page = currentWorkspace.blockSuiteWorkspace.createPage({
|
||||
id: pageId,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user