fix(editor): missing edgeless crud piece (#9347)

This commit is contained in:
Mirone
2024-12-26 19:06:06 +08:00
committed by GitHub
parent 6d5733fca9
commit 37747369bc
3 changed files with 24 additions and 21 deletions
@@ -1,3 +1,4 @@
import { EdgelessCRUDIdentifier } from '@blocksuite/affine-block-surface';
import {
EMBED_CARD_HEIGHT,
EMBED_CARD_WIDTH,
@@ -33,16 +34,16 @@ export class EmbedEdgelessLinkedDocBlockComponent extends toEdgelessEmbedBlock(
return;
}
// @ts-expect-error TODO: fix after edgeless refactor
const newId = edgelessService.addBlock(
const { addBlock } = this.std.get(EdgelessCRUDIdentifier);
const surface = this.gfx.surface ?? undefined;
const newId = addBlock(
'affine:embed-synced-doc',
{
xywh: bound.serialize(),
caption,
...cloneReferenceInfoWithoutAliases(this.referenceInfo$.peek()),
},
// @ts-expect-error TODO: fix after edgeless refactor
edgelessService.surface
surface
);
this.std.command.exec('reassociateConnectors', {
@@ -50,8 +51,7 @@ export class EmbedEdgelessLinkedDocBlockComponent extends toEdgelessEmbedBlock(
newId,
});
// @ts-expect-error TODO: fix after edgeless refactor
edgelessService.selection.set({
this.gfx.selection.set({
editing: false,
elements: [newId],
});