There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
refactor: ref page use AffineEditor
lawvsdcdc7f8862e3
diff --git a/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardItem.tsx b/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardItem.tsxindex eba13f0db6..c1cc9f9a1c 100644--- a/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardItem.tsx+++ b/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardItem.tsx@@ -1,9 +1,5 @@import type { KanbanCard } from '@toeverything/components/editor-core';-import {- RenderBlock,- useKanban,- useRefPage,-} from '@toeverything/components/editor-core';+import { RenderBlock, useKanban } from '@toeverything/components/editor-core';import { PenIcon } from '@toeverything/components/icons';import {IconButton,@@ -12,6 +8,7 @@ import {} from '@toeverything/components/ui';import { useFlag } from '@toeverything/datasource/feature-flags';import { useState } from 'react';+import { useRefPage } from './RefPage';const CardContent = styled('div')({margin: '20px',diff --git a/libs/components/editor-core/src/ref-page/ModalPage.tsx b/libs/components/editor-blocks/src/blocks/group/scene-kanban/RefPage.tsxsimilarity index 82%rename from libs/components/editor-core/src/ref-page/ModalPage.tsxrename to libs/components/editor-blocks/src/blocks/group/scene-kanban/RefPage.tsxindex 52e1d6554f..cd3588162e 100644--- a/libs/components/editor-core/src/ref-page/ModalPage.tsx+++ b/libs/components/editor-blocks/src/blocks/group/scene-kanban/RefPage.tsx@@ -1,7 +1,8 @@+import { AffineEditor } from '@toeverything/components/affine-editor';+import { useEditor } from '@toeverything/components/editor-core';import { MuiBackdrop, styled, useTheme } from '@toeverything/components/ui';import { createContext, ReactNode, useContext, useState } from 'react';import { createPortal } from 'react-dom';-import { RenderBlock } from '../render-block';const Dialog = styled('div')({flex: 1,@@ -30,7 +31,7 @@ const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => {onClick={closeSubPage}><Dialog- onClick={e => {+ onClick={(e: { stopPropagation: () => void }) => {e.stopPropagation();}}>@@ -43,9 +44,18 @@ const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => {};const ModalPage = ({ blockId }: { blockId: string | null }) => {+ const { editor } = useEditor();+return (<Modal open={!!blockId}>- {blockId && <RenderBlock blockId={blockId} />}+ {blockId && (+ <AffineEditor+ workspace={editor.workspace}+ rootBlockId={blockId}+ scrollBlank={false}+ isWhiteboard+ />+ )}</Modal>);};diff --git a/libs/components/editor-core/src/index.ts b/libs/components/editor-core/src/index.tsindex bea2fed3a0..d28d8e96b3 100644--- a/libs/components/editor-core/src/index.ts+++ b/libs/components/editor-core/src/index.ts@@ -16,4 +16,4 @@ export * from './utils';export * from './editor';-export { RefPageProvider, useRefPage } from './ref-page';+export { useEditor } from './Contexts';diff --git a/libs/components/editor-core/src/recast-block/Context.tsx b/libs/components/editor-core/src/recast-block/Context.tsxindex 47ec6cfcdb..4236ede55a 100644--- a/libs/components/editor-core/src/recast-block/Context.tsx+++ b/libs/components/editor-core/src/recast-block/Context.tsx@@ -2,7 +2,6 @@ import { Protocol } from '@toeverything/datasource/db-service';import { AsyncBlock } from '../editor';import { ComponentType, createContext, ReactNode, useContext } from 'react';import { RecastBlock } from './types';-import { RefPageProvider } from '../ref-page';/*** Determine whether the block supports RecastBlock@@ -48,7 +47,7 @@ export const RecastBlockProvider = ({return (<RecastBlockContext.Provider value={block}>- <RefPageProvider>{children}</RefPageProvider>+ {children}</RecastBlockContext.Provider>);};diff --git a/libs/components/editor-core/src/ref-page/index.ts b/libs/components/editor-core/src/ref-page/index.tsdeleted file mode 100644index 4b06310a5c..0000000000--- a/libs/components/editor-core/src/ref-page/index.ts+++ /dev/null@@ -1 +0,0 @@-export { useRefPage, RefPageProvider } from './ModalPage';