fix: workaround circular dependency editor element

This commit is contained in:
lawvs
2022-08-18 17:11:39 +08:00
parent 06d442a8c1
commit 0d89fa1026
@@ -1,4 +1,3 @@
import { AffineEditor } from '@toeverything/components/affine-editor';
import { useEditor } from '@toeverything/components/editor-core'; import { useEditor } from '@toeverything/components/editor-core';
import { MuiBackdrop, styled, useTheme } from '@toeverything/components/ui'; import { MuiBackdrop, styled, useTheme } from '@toeverything/components/ui';
import { createContext, ReactNode, useContext, useState } from 'react'; import { createContext, ReactNode, useContext, useState } from 'react';
@@ -44,7 +43,9 @@ const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => {
}; };
const ModalPage = ({ blockId }: { blockId: string | null }) => { const ModalPage = ({ blockId }: { blockId: string | null }) => {
const { editor } = useEditor(); const { editor, editorElement } = useEditor();
const AffineEditor = editorElement as any;
return ( return (
<Modal open={!!blockId}> <Modal open={!!blockId}>
@@ -53,6 +54,7 @@ const ModalPage = ({ blockId }: { blockId: string | null }) => {
workspace={editor.workspace} workspace={editor.workspace}
rootBlockId={blockId} rootBlockId={blockId}
scrollBlank={false} scrollBlank={false}
// use edgeless mode prevent padding and blank bottom
isEdgeless isEdgeless
/> />
)} )}