From f48e414d3dceec4d0be3af54b6a970ac7ac65542 Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Tue, 13 Sep 2022 15:50:06 +0800 Subject: [PATCH] fix: empty ref page --- .../src/blocks/group/scene-kanban/RefPage.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libs/components/editor-blocks/src/blocks/group/scene-kanban/RefPage.tsx b/libs/components/editor-blocks/src/blocks/group/scene-kanban/RefPage.tsx index 34d6dbb583..aa4fbcfacb 100644 --- a/libs/components/editor-blocks/src/blocks/group/scene-kanban/RefPage.tsx +++ b/libs/components/editor-blocks/src/blocks/group/scene-kanban/RefPage.tsx @@ -1,6 +1,13 @@ import { useEditor } from '@toeverything/components/editor-core'; import { MuiBackdrop, styled, useTheme } from '@toeverything/components/ui'; -import { createContext, ReactNode, useContext, useState } from 'react'; +import { + createContext, + ReactNode, + useContext, + useEffect, + useRef, + useState, +} from 'react'; import { createPortal } from 'react-dom'; const Dialog = styled('div')({ @@ -11,7 +18,7 @@ const Dialog = styled('div')({ boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', borderRadius: '10px', padding: '72px 120px', - overflow: 'scroll', + overflowY: 'auto', }); const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => { @@ -48,13 +55,20 @@ const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => { const ModalPage = ({ blockId }: { blockId: string | null }) => { const { editor, editorElement } = useEditor(); + const editorRef = useRef(null); const AffineEditor = editorElement as any; + // Active block after modal open + useEffect(() => { + editorRef.current?.selectionManager.activeNodeByNodeId(blockId); + }, [blockId]); + return ( {blockId && (