mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	chore(react/collections/table): bring back refresh
This commit is contained in:
		| @@ -151,7 +151,7 @@ | |||||||
| } | } | ||||||
|  |  | ||||||
| .board-view-container .board-note.shift-down { | .board-view-container .board-note.shift-down { | ||||||
|   margin-top: 45px; |   transform: translateY(100%); | ||||||
| } | } | ||||||
|  |  | ||||||
| .board-view-container .board-note.editing { | .board-view-container .board-note.editing { | ||||||
|   | |||||||
| @@ -46,9 +46,6 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC | |||||||
|     useEffect(refresh, [ parentNote, noteIds ]); |     useEffect(refresh, [ parentNote, noteIds ]); | ||||||
|  |  | ||||||
|     useTriliumEvent("entitiesReloaded", ({ loadResults }) => { |     useTriliumEvent("entitiesReloaded", ({ loadResults }) => { | ||||||
|         // TODO: Re-enable |  | ||||||
|         return; |  | ||||||
|  |  | ||||||
|         // Check if any changes affect our board |         // Check if any changes affect our board | ||||||
|         const hasRelevantChanges = |         const hasRelevantChanges = | ||||||
|             // React to changes in status attribute for notes in this board |             // React to changes in status attribute for notes in this board | ||||||
| @@ -65,7 +62,6 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC | |||||||
|             loadResults.getAttributeRows().some(attr => attr.name === "board:groupBy" && attr.noteId === parentNote.noteId); |             loadResults.getAttributeRows().some(attr => attr.name === "board:groupBy" && attr.noteId === parentNote.noteId); | ||||||
|  |  | ||||||
|         if (hasRelevantChanges) { |         if (hasRelevantChanges) { | ||||||
|             console.log("Trigger refresh"); |  | ||||||
|             refresh(); |             refresh(); | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| @@ -123,23 +119,23 @@ function Column({ | |||||||
|     const handleDragOver = useCallback((e: DragEvent) => { |     const handleDragOver = useCallback((e: DragEvent) => { | ||||||
|         e.preventDefault(); |         e.preventDefault(); | ||||||
|         setDropTarget(column); |         setDropTarget(column); | ||||||
|          |  | ||||||
|         // Calculate drop position based on mouse position |         // Calculate drop position based on mouse position | ||||||
|         const cards = Array.from(e.currentTarget.querySelectorAll('.board-note')); |         const cards = Array.from(e.currentTarget.querySelectorAll('.board-note')); | ||||||
|         const mouseY = e.clientY; |         const mouseY = e.clientY; | ||||||
|          |  | ||||||
|         let newIndex = cards.length; |         let newIndex = cards.length; | ||||||
|         for (let i = 0; i < cards.length; i++) { |         for (let i = 0; i < cards.length; i++) { | ||||||
|             const card = cards[i] as HTMLElement; |             const card = cards[i] as HTMLElement; | ||||||
|             const rect = card.getBoundingClientRect(); |             const rect = card.getBoundingClientRect(); | ||||||
|             const cardMiddle = rect.top + rect.height / 2; |             const cardMiddle = rect.top + rect.height / 2; | ||||||
|              |  | ||||||
|             if (mouseY < cardMiddle) { |             if (mouseY < cardMiddle) { | ||||||
|                 newIndex = i; |                 newIndex = i; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|          |  | ||||||
|         setDropPosition({ column, index: newIndex }); |         setDropPosition({ column, index: newIndex }); | ||||||
|     }, [column, setDropTarget, setDropPosition]); |     }, [column, setDropTarget, setDropPosition]); | ||||||
|  |  | ||||||
| @@ -183,14 +179,14 @@ function Column({ | |||||||
|             </h3> |             </h3> | ||||||
|  |  | ||||||
|             {(columnItems ?? []).map(({ note, branch }, index) => { |             {(columnItems ?? []).map(({ note, branch }, index) => { | ||||||
|                 const showIndicatorBefore = dropPosition?.column === column &&  |                 const showIndicatorBefore = dropPosition?.column === column && | ||||||
|                                           dropPosition.index === index &&  |                                           dropPosition.index === index && | ||||||
|                                           draggedCard?.noteId !== note.noteId; |                                           draggedCard?.noteId !== note.noteId; | ||||||
|                 const shouldShift = dropPosition?.column === column &&  |                 const shouldShift = dropPosition?.column === column && | ||||||
|                                    dropPosition.index <= index &&  |                                    dropPosition.index <= index && | ||||||
|                                    draggedCard?.noteId !== note.noteId && |                                    draggedCard?.noteId !== note.noteId && | ||||||
|                                    draggedCard !== null; |                                    draggedCard !== null; | ||||||
|                  |  | ||||||
|                 return ( |                 return ( | ||||||
|                     <> |                     <> | ||||||
|                         {showIndicatorBefore && ( |                         {showIndicatorBefore && ( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user