refactor(editor): extract edgeless legacy slots (#9363)

This commit is contained in:
Saul-Mirone
2024-12-27 04:22:52 +00:00
parent 71272203b0
commit 3ae3ae98c8
24 changed files with 167 additions and 113 deletions

View File

@@ -76,9 +76,9 @@ export function insertEmbedCard(
editing: false,
});
// @ts-expect-error TODO: fix after edgeless refactor
edgelessRoot.tools.setEdgelessTool({
type: 'default',
});
gfx.tool.setTool(
// @ts-expect-error FIXME: resolve after gfx tool refactor
'default'
);
}
}

View File

@@ -1,3 +1,4 @@
import { EdgelessLegacySlotIdentifier } from '@blocksuite/affine-block-surface';
import {
blockComponentSymbol,
type BlockService,
@@ -49,21 +50,22 @@ export function toEdgelessEmbedBlock<
return;
}
get edgelessSlots() {
return this.std.get(EdgelessLegacySlotIdentifier);
}
override connectedCallback(): void {
super.connectedCallback();
const rootService = this.rootService;
this._disposables.add(
// @ts-expect-error TODO: fix after edgeless slots are migrated to extension
rootService.slots.elementResizeStart.on(() => {
this.edgelessSlots.elementResizeStart.on(() => {
this._isResizing = true;
this._showOverlay = true;
})
);
this._disposables.add(
// @ts-expect-error TODO: fix after edgeless slots are migrated to extension
rootService.slots.elementResizeEnd.on(() => {
this.edgelessSlots.elementResizeEnd.on(() => {
this._isResizing = false;
this._showOverlay =
this._isResizing || this._isDragging || !this._isSelected;

View File

@@ -1,3 +1,5 @@
import type * as SurfaceEffects from '@blocksuite/affine-block-surface/effects';
import { EmbedFigmaBlockComponent } from './embed-figma-block';
import { EmbedEdgelessBlockComponent } from './embed-figma-block/embed-edgeless-figma-block';
import type { EmbedFigmaBlockService } from './embed-figma-block/embed-figma-service';
@@ -90,6 +92,8 @@ export function effects() {
);
}
declare type _GLOBAL = typeof SurfaceEffects;
declare global {
interface HTMLElementTagNameMap {
'affine-embed-figma-block': EmbedFigmaBlockComponent;

View File

@@ -27,6 +27,9 @@
},
{
"path": "../shared"
},
{
"path": "../block-surface"
}
]
}