mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
chore(react/collections/board): improve note dragging experience
This commit is contained in:
parent
7edfaad04e
commit
8bde2092c6
@ -36,6 +36,7 @@ export default function Card({
|
||||
const colorClass = note.getColorClass() || '';
|
||||
const editorRef = useRef<HTMLInputElement>(null);
|
||||
const isArchived = note.isArchived;
|
||||
const [ isVisible, setVisible ] = useState(true);
|
||||
const [ title, setTitle ] = useState(note.title);
|
||||
|
||||
const handleDragStart = useCallback((e: DragEvent) => {
|
||||
@ -70,6 +71,10 @@ export default function Card({
|
||||
setTitle(note.title);
|
||||
}, [ note ]);
|
||||
|
||||
useEffect(() => {
|
||||
setVisible(!isDragging);
|
||||
}, [ isDragging ]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`board-note ${colorClass} ${isDragging ? 'dragging' : ''} ${isEditing ? "editing" : ""} ${isArchived ? "archived" : ""}`}
|
||||
@ -78,6 +83,9 @@ export default function Card({
|
||||
onDragEnd={handleDragEnd}
|
||||
onContextMenu={handleContextMenu}
|
||||
onClick={!isEditing ? handleOpen : undefined}
|
||||
style={{
|
||||
display: !isVisible ? "none" : undefined
|
||||
}}
|
||||
>
|
||||
{!isEditing ? (
|
||||
<>
|
||||
|
Loading…
x
Reference in New Issue
Block a user