fix: page references in list/database (#3702)

This commit is contained in:
Peng Xiao
2023-08-12 00:20:33 +08:00
committed by GitHub
parent 9639143df4
commit 1eaf228a30

View File

@@ -7,8 +7,8 @@ import { useBlockSuiteWorkspacePage } from './use-block-suite-workspace-page';
const weakMap = new WeakMap<Page, Atom<string[]>>();
function getPageReferences(page: Page): string[] {
// todo: is there a way to use page indexer to get all references?
return page
.getBlockByFlavour('affine:paragraph')
return ['affine:paragraph', 'affine:list', 'affine:database']
.flatMap(f => page.getBlockByFlavour(f))
.flatMap(b => b.text?.toDelta())
.map(v => v?.attributes?.reference?.pageId)
.filter(Boolean);