mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 05:58:56 +08:00
Merge pull request #233 from LuciNyan/fix-drop-line
fix(libs): remove line after drop
This commit is contained in:
@@ -75,21 +75,6 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
|||||||
[editor, groupBlock]
|
[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 handleRootMouseLeave = useCallback(() => setGroupBlock(null), []);
|
||||||
|
|
||||||
const handleRootDragEnd = () => {
|
const handleRootDragEnd = () => {
|
||||||
@@ -128,7 +113,6 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
|||||||
handleRootMouseMove,
|
handleRootMouseMove,
|
||||||
handleRootMouseDown,
|
handleRootMouseDown,
|
||||||
handleRootDragOver,
|
handleRootDragOver,
|
||||||
handleRootDrop,
|
|
||||||
handleRootMouseLeave,
|
handleRootMouseLeave,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -170,7 +154,11 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
|||||||
setShowMenu(false);
|
setShowMenu(false);
|
||||||
|
|
||||||
if (groupBlock) {
|
if (groupBlock) {
|
||||||
const unobserve = groupBlock.onUpdate(() => setGroupBlock(null));
|
const unobserve = groupBlock.onUpdate(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
setGroupBlock(null);
|
||||||
|
});
|
||||||
|
});
|
||||||
return unobserve;
|
return unobserve;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user