mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 14:28:51 +08:00
fix: quick search tips follow when resize (#1580)
Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import { assertExists, Page } from '@blocksuite/store';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import dynamic from 'next/dynamic';
|
||||
import Head from 'next/head';
|
||||
import React from 'react';
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
import { currentEditorAtom } from '../atoms';
|
||||
import { useBlockSuiteWorkspacePageTitle } from '../hooks/use-blocksuite-workspace-page-title';
|
||||
import { usePageMeta } from '../hooks/use-page-meta';
|
||||
import { BlockSuiteWorkspace } from '../shared';
|
||||
@@ -45,6 +47,7 @@ export const PageDetailEditor: React.FC<PageDetailEditorProps> = ({
|
||||
const meta = usePageMeta(blockSuiteWorkspace).find(
|
||||
meta => meta.id === pageId
|
||||
);
|
||||
const setEditor = useSetAtom(currentEditorAtom);
|
||||
assertExists(meta);
|
||||
return (
|
||||
<>
|
||||
@@ -68,7 +71,13 @@ export const PageDetailEditor: React.FC<PageDetailEditorProps> = ({
|
||||
// fixme: remove mode from meta
|
||||
mode={isPublic ? 'page' : meta.mode ?? 'page'}
|
||||
page={page}
|
||||
onInit={onInit}
|
||||
onInit={useCallback(
|
||||
(page: Page, editor: Readonly<EditorContainer>) => {
|
||||
setEditor(editor);
|
||||
onInit(page, editor);
|
||||
},
|
||||
[onInit, setEditor]
|
||||
)}
|
||||
onLoad={onLoad}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user