mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix: api compatibility with blocksuite
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { TreeViewProps } from '@affine/component';
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { initPage } from '@affine/env/blocksuite';
|
||||
import type { PageMeta } from '@blocksuite/store';
|
||||
import { nanoid } from '@blocksuite/store';
|
||||
import { usePageMetaHelper } from '@toeverything/hooks/use-block-suite-page-meta';
|
||||
@@ -64,7 +65,16 @@ export function usePinboardHandler({
|
||||
const addPin = useCallback(
|
||||
(parentId: string) => {
|
||||
const id = nanoid();
|
||||
createPage(id, parentId);
|
||||
const page = createPage(id);
|
||||
initPage(page);
|
||||
page.addBlock('affine:paragraph', {
|
||||
text: page.Text.fromDelta([
|
||||
{
|
||||
insert: ' ',
|
||||
attributes: { reference: { type: 'LinkedPage', pageId: page.id } },
|
||||
},
|
||||
]),
|
||||
});
|
||||
onAdd?.(id, parentId);
|
||||
addReferenceLink(parentId, id);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user