fix: editor overflow (#1253)

This commit is contained in:
Himself65
2023-03-02 00:39:49 -06:00
committed by GitHub
parent f34a64a82a
commit 68b33cbdbd
2 changed files with 6 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ import { BlockHub } from '@blocksuite/blocks';
import { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
import { assertExists } from '@blocksuite/store';
import { useEffect, useRef } from 'react';
import { CSSProperties, useEffect, useRef } from 'react';
import { BlockSuiteWorkspace } from '../../../shared';
@@ -13,6 +13,7 @@ export type EditorProps = {
mode: 'page' | 'edgeless';
onInit?: (page: Page, editor: Readonly<EditorContainer>) => void;
onLoad?: (page: Page, editor: EditorContainer) => void;
style?: CSSProperties;
};
import markdown from '../../../templates/Welcome-to-AFFiNE-Alpha-Downhills.md';
@@ -112,5 +113,5 @@ export const BlockSuiteEditor = (props: EditorProps) => {
container.removeChild(editor);
};
}, [page]);
return <div className="editor-wrapper" ref={ref} />;
return <div className="editor-wrapper" style={props.style} ref={ref} />;
};

View File

@@ -54,6 +54,9 @@ export const PageDetailEditor: React.FC<PageDetailEditorProps> = ({
{header}
</BlockSuiteEditorHeader>
<Editor
style={{
height: 'calc(100% - 60px)',
}}
blockSuiteWorkspace={blockSuiteWorkspace}
mode={meta.mode ?? 'page'}
page={page}