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