mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
fix: Labels delete & reordering (#2729)
* fix: Labels reordering inconsistency * fix: Delete child labels * feat: multi-select while grouping labels * refactor: label sorting in mobx computed function * feat: drag & drop label grouping, un-grouping * chore: removed label select modal * fix: moving labels from project store to project label store * fix: typo changes and build tree function added * labels feature * disable dropping group into a group * fix build errors * fix more issues * chore: added combining state UI, fixed scroll issue for label groups * chore: group icon for label groups * fix: group cannot be dropped in another group --------- Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: rahulramesha <rahulramesham@gmail.com> Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
This commit is contained in:
committed by
sriram veeraghanta
parent
d933c73343
commit
63b6150b9c
31
web/hooks/use-draggable-portal.ts
Normal file
31
web/hooks/use-draggable-portal.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { createPortal } from "react-dom";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { DraggableProvided, DraggableStateSnapshot } from "@hello-pangea/dnd";
|
||||
|
||||
const useDraggableInPortal = () => {
|
||||
const self = useRef<Element>();
|
||||
|
||||
useEffect(() => {
|
||||
const div = document.createElement("div");
|
||||
div.style.position = "absolute";
|
||||
div.style.pointerEvents = "none";
|
||||
div.style.top = "0";
|
||||
div.style.width = "100%";
|
||||
div.style.height = "100%";
|
||||
self.current = div;
|
||||
document.body.appendChild(div);
|
||||
return () => {
|
||||
document.body.removeChild(div);
|
||||
};
|
||||
}, [self.current]);
|
||||
|
||||
return (render: any) => (provided: DraggableProvided, snapshot: DraggableStateSnapshot) => {
|
||||
const element = render(provided, snapshot);
|
||||
if (self.current && snapshot?.isDragging) {
|
||||
return createPortal(element, self.current);
|
||||
}
|
||||
return element;
|
||||
};
|
||||
};
|
||||
|
||||
export default useDraggableInPortal;
|
||||
Reference in New Issue
Block a user