fix: hide blockHub in edgeless mode (#1447)

Co-authored-by: Himself65 <himself65@outlook.com>
This commit is contained in:
x1a0t
2023-03-09 15:29:58 +08:00
committed by GitHub
parent 6b533c44be
commit ce37b5a8c3
@@ -101,7 +101,10 @@ export const BlockSuiteEditor = (props: EditorProps) => {
if (!editor || !container || !page) { if (!editor || !container || !page) {
return; return;
} }
if (page.awarenessStore.getFlag('enable_block_hub')) { if (
page.awarenessStore.getFlag('enable_block_hub') &&
props.mode === 'page'
) {
editor.createBlockHub().then(blockHub => { editor.createBlockHub().then(blockHub => {
if (blockHubRef.current) { if (blockHubRef.current) {
blockHubRef.current.remove(); blockHubRef.current.remove();
@@ -118,7 +121,7 @@ export const BlockSuiteEditor = (props: EditorProps) => {
blockHubRef.current?.remove(); blockHubRef.current?.remove();
container.removeChild(editor); container.removeChild(editor);
}; };
}, [page]); }, [page, props.mode]);
return ( return (
<div <div
data-testid={`editor-${props.blockSuiteWorkspace.id}-${props.page.id}`} data-testid={`editor-${props.blockSuiteWorkspace.id}-${props.page.id}`}