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