fix(editor): missing connectors when click copy as image action in surface-ref-toolbar (#11137)

Continue #10933
This commit is contained in:
L-Sun
2025-03-26 08:57:38 +00:00
parent c5624bfd13
commit 6b4a5b1d71
3 changed files with 39 additions and 107 deletions

View File

@@ -44,7 +44,7 @@ export const BUILT_IN_GROUPS: MenuItemGroup<SurfaceRefToolbarContext>[] = [
return;
}
edgelessToBlob(ctx.host, {
edgelessToBlob(editor, {
surfaceRefBlock: ctx.blockComponent,
surfaceRenderer,
edgelessElement: referencedModel,
@@ -84,7 +84,7 @@ export const BUILT_IN_GROUPS: MenuItemGroup<SurfaceRefToolbarContext>[] = [
return;
}
edgelessToBlob(ctx.host, {
edgelessToBlob(editor, {
surfaceRefBlock: ctx.blockComponent,
surfaceRenderer,
edgelessElement: referencedModel,

View File

@@ -1,7 +1,6 @@
import type { CanvasRenderer } from '@blocksuite/affine-block-surface';
import { ExportManager } from '@blocksuite/affine-block-surface';
import type { SurfaceRefBlockComponent } from '@blocksuite/affine-block-surface-ref';
import { isTopLevelBlock } from '@blocksuite/affine-shared/utils';
import type { EditorHost } from '@blocksuite/block-std';
import {
GfxControllerIdentifier,
@@ -21,15 +20,14 @@ export const edgelessToBlob = async (
const { edgelessElement } = options;
const exportManager = host.std.get(ExportManager);
const bound = Bound.deserialize(edgelessElement.xywh);
const isBlock = isTopLevelBlock(edgelessElement);
const gfx = host.std.get(GfxControllerIdentifier);
const canvas = await exportManager.edgelessToCanvas(
options.surfaceRenderer,
bound,
gfx,
isBlock ? [edgelessElement] : undefined,
isBlock ? undefined : [edgelessElement],
undefined,
undefined,
{ zoom: options.surfaceRenderer.viewport.zoom }
);