fix: block should not be selectable when dragged into note (#10664)

### Changed
- Fixed the issue that block can still be selected when dragged into note
- Rewrite grid and layer with extension infra
This commit is contained in:
doouding
2025-03-07 04:40:05 +00:00
parent 0a234fa263
commit 460e088873
5 changed files with 187 additions and 143 deletions
@@ -1,5 +1,5 @@
import type { EditorHost } from '@blocksuite/affine/block-std';
import { LayerManager } from '@blocksuite/affine/block-std/gfx';
import { GfxController, LayerManager } from '@blocksuite/affine/block-std/gfx';
import {
getSurfaceBlock,
TemplateJob,
@@ -14,9 +14,7 @@ export function createTemplateJob(host: EditorHost) {
}
const middlewares: ((job: TemplateJob) => void)[] = [];
const layer = new LayerManager(host.doc, surface, {
watch: false,
});
const layer = new LayerManager(host.std.get(GfxController));
const bounds = [...layer.blocks, ...layer.canvasElements].map(i =>
Bound.deserialize(i.xywh)
);