refactor(page): rename pageId

This commit is contained in:
tzhangchi
2022-09-08 19:20:37 +08:00
parent 9442c023e5
commit 281c3f6c44
17 changed files with 58 additions and 61 deletions
@@ -6,16 +6,16 @@ import { CreateView } from '@toeverything/framework/virgo';
type RefLinkView = CreateView;
export const RefLinkView = ({ block, editor }: RefLinkView) => {
const page_id = useMemo(() => block.getProperty('reference'), [block]);
const pageId = useMemo(() => block.getProperty('reference'), [block]);
const [block_content, set_block] =
useState<Awaited<ReturnType<typeof editor.search>>[number]>();
useEffect(() => {
editor
.search({ tag: `id:${page_id}` })
.search({ tag: `id:${pageId}` })
.then(block => set_block(block[0]));
}, [editor, page_id]);
}, [editor, pageId]);
return <InlineRefLink block={block_content} pageId={page_id} />;
return <InlineRefLink block={block_content} pageId={pageId} />;
};