mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
feat: select in grid
This commit is contained in:
@@ -252,6 +252,7 @@ export class DragDropManager {
|
||||
}
|
||||
|
||||
public handlerEditorDrop(event: React.DragEvent<Element>) {
|
||||
event.preventDefault();
|
||||
// IMP: can not use Decorators now may use decorators is right
|
||||
if (this.isEnabled()) {
|
||||
if (this.isDragBlock(event)) {
|
||||
|
||||
@@ -324,9 +324,21 @@ export class SelectionManager implements VirgoSelection {
|
||||
}
|
||||
if (block && block.dom) {
|
||||
if (selectionRect.isIntersect(domToRect(block.dom))) {
|
||||
const selectableChildren = await (
|
||||
await block.children()
|
||||
).filter(childBlock => {
|
||||
const childrenBlocks = await block.children();
|
||||
// should check directly in structured block
|
||||
const structuredChildrenBlocks: Array<AsyncBlock> =
|
||||
childrenBlocks.filter(childBlock => {
|
||||
return this._editor.getView(childBlock.type).layoutOnly;
|
||||
});
|
||||
for await (const childBlock of structuredChildrenBlocks) {
|
||||
const childSelectedNodes =
|
||||
await this.calcRenderBlockIntersect(
|
||||
selectionRect,
|
||||
childBlock
|
||||
);
|
||||
selectedNodes.push(...childSelectedNodes);
|
||||
}
|
||||
const selectableChildren = childrenBlocks.filter(childBlock => {
|
||||
return this._editor.getView(childBlock.type).selectable;
|
||||
});
|
||||
for await (const childBlock of selectableChildren) {
|
||||
@@ -350,6 +362,7 @@ export class SelectionManager implements VirgoSelection {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log({ selectedNodes });
|
||||
return selectedNodes;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user