diff --git a/libs/components/editor-blocks/src/blocks/grid-item/index.ts b/libs/components/editor-blocks/src/blocks/grid-item/index.ts index 88d5023cf8..7f51c47a05 100644 --- a/libs/components/editor-blocks/src/blocks/grid-item/index.ts +++ b/libs/components/editor-blocks/src/blocks/grid-item/index.ts @@ -8,6 +8,7 @@ export class GridItemBlock extends BaseView { public override selectable = false; public override activatable = false; public override allowPendant = false; + public override layoutOnly = true; type = Protocol.Block.Type.grid; View = GridItemRender(GridItem); diff --git a/libs/components/editor-blocks/src/blocks/grid/index.ts b/libs/components/editor-blocks/src/blocks/grid/index.ts index 984bd82710..ec6c363819 100644 --- a/libs/components/editor-blocks/src/blocks/grid/index.ts +++ b/libs/components/editor-blocks/src/blocks/grid/index.ts @@ -9,6 +9,7 @@ export class GridBlock extends BaseView { public override selectable = false; public override activatable = false; public override allowPendant = false; + public override layoutOnly = true; type = Protocol.Block.Type.grid; View = GridRender(Grid); diff --git a/libs/components/editor-core/src/editor/drag-drop/drag-drop.ts b/libs/components/editor-core/src/editor/drag-drop/drag-drop.ts index e3da55fcb5..b8f602fb2c 100644 --- a/libs/components/editor-core/src/editor/drag-drop/drag-drop.ts +++ b/libs/components/editor-core/src/editor/drag-drop/drag-drop.ts @@ -252,6 +252,7 @@ export class DragDropManager { } public handlerEditorDrop(event: React.DragEvent) { + event.preventDefault(); // IMP: can not use Decorators now may use decorators is right if (this.isEnabled()) { if (this.isDragBlock(event)) { diff --git a/libs/components/editor-core/src/editor/selection/selection.ts b/libs/components/editor-core/src/editor/selection/selection.ts index 0b60b789b4..72ad0d9473 100644 --- a/libs/components/editor-core/src/editor/selection/selection.ts +++ b/libs/components/editor-core/src/editor/selection/selection.ts @@ -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 = + 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; } diff --git a/libs/utils/src/types/tools.ts b/libs/utils/src/types/tools.ts index 1f2fe05285..73372b6787 100644 --- a/libs/utils/src/types/tools.ts +++ b/libs/utils/src/types/tools.ts @@ -3,7 +3,7 @@ * * @example * ```ts - * // except: type Values = 1 | '2' + * except: type Values = 1 | '2' * type Values = ValueOf<{a: 1, b: '2'}> * ``` */ @@ -14,7 +14,7 @@ export type ValueOf> = X[keyof X]; * * @example * ```ts - * // except: type FirstType = string; + * except: type FirstType = string; * type FirstType = First<[string], 0> * ``` */ @@ -25,7 +25,7 @@ export type IndexOf = X[I]; * * @example * ```ts - * // except: type FirstType = string; + * except: type FirstType = string; * type FirstType = First<[string]> * ``` */