Revert "fix: api compatibility with blocksuite"
This reverts commit 00f44c72ce.
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import type { TreeViewProps } from '@affine/component';
|
import type { TreeViewProps } from '@affine/component';
|
||||||
import { DebugLogger } from '@affine/debug';
|
import { DebugLogger } from '@affine/debug';
|
||||||
import { initPage } from '@affine/env/blocksuite';
|
|
||||||
import type { PageMeta } from '@blocksuite/store';
|
import type { PageMeta } from '@blocksuite/store';
|
||||||
import { nanoid } from '@blocksuite/store';
|
import { nanoid } from '@blocksuite/store';
|
||||||
import { usePageMetaHelper } from '@toeverything/hooks/use-block-suite-page-meta';
|
import { usePageMetaHelper } from '@toeverything/hooks/use-block-suite-page-meta';
|
||||||
@@ -65,16 +64,7 @@ export function usePinboardHandler({
|
|||||||
const addPin = useCallback(
|
const addPin = useCallback(
|
||||||
(parentId: string) => {
|
(parentId: string) => {
|
||||||
const id = nanoid();
|
const id = nanoid();
|
||||||
const page = createPage(id);
|
createPage(id, parentId);
|
||||||
initPage(page);
|
|
||||||
page.addBlock('affine:paragraph', {
|
|
||||||
text: page.Text.fromDelta([
|
|
||||||
{
|
|
||||||
insert: ' ',
|
|
||||||
attributes: { reference: { type: 'LinkedPage', pageId: page.id } },
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
});
|
|
||||||
onAdd?.(id, parentId);
|
onAdd?.(id, parentId);
|
||||||
addReferenceLink(parentId, id);
|
addReferenceLink(parentId, id);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import { useMemo } from 'react';
|
|||||||
export function useBlockSuiteWorkspaceHelper(blockSuiteWorkspace: Workspace) {
|
export function useBlockSuiteWorkspaceHelper(blockSuiteWorkspace: Workspace) {
|
||||||
return useMemo(
|
return useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
createPage: (pageId: string): Page => {
|
createPage: (pageId: string, parentId?: string): Page => {
|
||||||
assertExists(blockSuiteWorkspace);
|
assertExists(blockSuiteWorkspace);
|
||||||
return blockSuiteWorkspace.createPage(pageId);
|
return blockSuiteWorkspace.createPage(pageId, parentId);
|
||||||
},
|
},
|
||||||
markMilestone: async (name: string) => {
|
markMilestone: async (name: string) => {
|
||||||
assertExists(blockSuiteWorkspace);
|
assertExists(blockSuiteWorkspace);
|
||||||
|
|||||||
Reference in New Issue
Block a user