mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-31 18:04:42 +03:00
fix(libs): remove line after drop
This commit is contained in:
parent
5cec5a363d
commit
67f0a2516b
@ -4,7 +4,7 @@ import {
|
||||
PluginHooks,
|
||||
Virgo,
|
||||
} from '@toeverything/components/editor-core';
|
||||
import { Point } from '@toeverything/utils';
|
||||
import { Point, sleep } from '@toeverything/utils';
|
||||
import { GroupDirection } from '@toeverything/framework/virgo';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { DragItem } from './DragItem';
|
||||
@ -75,21 +75,6 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
||||
[editor, groupBlock]
|
||||
);
|
||||
|
||||
const handleRootDrop = useCallback(
|
||||
async (e: React.DragEvent<Element>) => {
|
||||
let groupBlockOnDrop = null;
|
||||
if (editor.dragDropManager.isDragGroup(e)) {
|
||||
groupBlockOnDrop = await editor.getGroupBlockByPoint(
|
||||
new Point(e.clientX, e.clientY)
|
||||
);
|
||||
if (groupBlockOnDrop?.id === groupBlock?.id) {
|
||||
groupBlockOnDrop = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
[editor, groupBlock]
|
||||
);
|
||||
|
||||
const handleRootMouseLeave = useCallback(() => setGroupBlock(null), []);
|
||||
|
||||
const handleRootDragEnd = () => {
|
||||
@ -128,7 +113,6 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
||||
handleRootMouseMove,
|
||||
handleRootMouseDown,
|
||||
handleRootDragOver,
|
||||
handleRootDrop,
|
||||
handleRootMouseLeave,
|
||||
]);
|
||||
|
||||
@ -170,7 +154,10 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
||||
setShowMenu(false);
|
||||
|
||||
if (groupBlock) {
|
||||
const unobserve = groupBlock.onUpdate(() => setGroupBlock(null));
|
||||
const unobserve = groupBlock.onUpdate(async () => {
|
||||
await sleep();
|
||||
setGroupBlock(null);
|
||||
});
|
||||
return unobserve;
|
||||
}
|
||||
return undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user