mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	make sure the sorted branches are still sorted after drag & drop, #2142
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -2890,9 +2890,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "electron": { |     "electron": { | ||||||
|       "version": "14.0.0", |       "version": "13.3.0", | ||||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-14.0.0.tgz", |       "resolved": "https://registry.npmjs.org/electron/-/electron-13.3.0.tgz", | ||||||
|       "integrity": "sha512-O6EI7L1BPIrTpEIFefjjmdbmSn9LtE4mmrv4dfpV4Mqaa8uKuNYQogwZPEvSwaBexb69eb1LQ25n+f+kBcjiRQ==", |       "integrity": "sha512-d/BvOLDjI4i7yf9tqCuLL2fFGA2TrM/D9PyRpua+rJolG0qrwp/FohP02L0m+44kmPpofIo4l3NPwLmzyKKimA==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "requires": { |       "requires": { | ||||||
|         "@electron/get": "^1.0.1", |         "@electron/get": "^1.0.1", | ||||||
|   | |||||||
| @@ -81,7 +81,7 @@ | |||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "cross-env": "7.0.3", |     "cross-env": "7.0.3", | ||||||
|     "electron": "14.0.0", |     "electron": "13.3.0", | ||||||
|     "electron-builder": "22.11.7", |     "electron-builder": "22.11.7", | ||||||
|     "electron-packager": "15.3.0", |     "electron-packager": "15.3.0", | ||||||
|     "electron-rebuild": "3.2.3", |     "electron-rebuild": "3.2.3", | ||||||
|   | |||||||
| @@ -85,8 +85,6 @@ function moveBranchBeforeNote(req) { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     entityChangesService.addNoteReorderingEntityChange(beforeBranch.parentNoteId); |  | ||||||
|  |  | ||||||
|     if (branchToMove.parentNoteId === beforeBranch.parentNoteId) { |     if (branchToMove.parentNoteId === beforeBranch.parentNoteId) { | ||||||
|         branchToMove.notePosition = originalBeforeNotePosition; |         branchToMove.notePosition = originalBeforeNotePosition; | ||||||
|         branchToMove.save(); |         branchToMove.save(); | ||||||
| @@ -98,6 +96,13 @@ function moveBranchBeforeNote(req) { | |||||||
|         branchToMove.markAsDeleted(); |         branchToMove.markAsDeleted(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (parentNote.hasLabel('sorted')) { | ||||||
|  |         treeService.sortNotesByTitle(parentNote.noteId, false, false); | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         entityChangesService.addNoteReorderingEntityChange(parentNote.noteId); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return { success: true }; |     return { success: true }; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -129,8 +134,6 @@ function moveBranchAfterNote(req) { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     entityChangesService.addNoteReorderingEntityChange(afterNote.parentNoteId); |  | ||||||
|  |  | ||||||
|     const movedNotePosition = originalAfterNotePosition + 10; |     const movedNotePosition = originalAfterNotePosition + 10; | ||||||
|  |  | ||||||
|     if (branchToMove.parentNoteId === afterNote.parentNoteId) { |     if (branchToMove.parentNoteId === afterNote.parentNoteId) { | ||||||
| @@ -144,6 +147,13 @@ function moveBranchAfterNote(req) { | |||||||
|         branchToMove.markAsDeleted(); |         branchToMove.markAsDeleted(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (parentNote.hasLabel('sorted')) { | ||||||
|  |         treeService.sortNotesByTitle(parentNote.noteId, false, false); | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         entityChangesService.addNoteReorderingEntityChange(parentNote.noteId); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return { success: true }; |     return { success: true }; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user