feat: new grid drop logic

This commit is contained in:
SaikaSakura
2022-08-09 18:44:14 +08:00
parent 73d7d4e1a8
commit 4522e0a56c
4 changed files with 52 additions and 22 deletions

View File

@@ -18,6 +18,7 @@ import {
menuItemsMap,
} from './config';
import { QueryResult } from '../../search';
import { getBlockIdByNode } from '@toeverything/utils';
export type CommandMenuProps = {
editor: Virgo;

View File

@@ -105,16 +105,17 @@ export class LeftMenuPlugin extends BasePlugin {
new Point(event.clientX, event.clientY)
);
if (block == null || ignoreBlockTypes.includes(block.type)) return;
const direction = await this.editor.dragDropManager.checkBlockDragTypes(
event,
block.dom,
block.id
);
const { direction, block: targetBlock } =
await this.editor.dragDropManager.checkBlockDragTypes(
event,
block.dom,
block.id
);
this._lineInfo.next({
direction,
blockInfo: {
block,
rect: block.dom.getBoundingClientRect(),
block: targetBlock,
rect: targetBlock.dom.getBoundingClientRect(),
},
});
};