mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	fix sorting after cloning/moving notes into sorted parent, closes #3453
This commit is contained in:
		| @@ -36,7 +36,9 @@ export default class HistoryNavigationButton extends ButtonFromNoteWidget { | |||||||
|  |  | ||||||
|         // API is broken and will be replaced: https://github.com/electron/electron/issues/33899 |         // API is broken and will be replaced: https://github.com/electron/electron/issues/33899 | ||||||
|         // until then no context menu |         // until then no context menu | ||||||
|  |         if (true) { // avoid warning in dev console | ||||||
|             return; |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         if (this.webContents.history.length < 2) { |         if (this.webContents.history.length < 2) { | ||||||
|             return; |             return; | ||||||
|   | |||||||
| @@ -4,8 +4,6 @@ const treeService = require('./tree'); | |||||||
| const noteService = require('./notes'); | const noteService = require('./notes'); | ||||||
| const becca = require('../becca/becca'); | const becca = require('../becca/becca'); | ||||||
| const Attribute = require('../becca/entities/attribute'); | const Attribute = require('../becca/entities/attribute'); | ||||||
| const debounce = require('debounce'); |  | ||||||
| const specialNotesService = require("./special_notes"); |  | ||||||
|  |  | ||||||
| function runAttachedRelations(note, relationName, originEntity) { | function runAttachedRelations(note, relationName, originEntity) { | ||||||
|     if (!note) { |     if (!note) { | ||||||
| @@ -101,7 +99,7 @@ eventService.subscribe(eventService.ENTITY_CREATED, ({ entityName, entity }) => | |||||||
|                 noteService.duplicateSubtreeWithoutRoot(templateNote.noteId, note.noteId); |                 noteService.duplicateSubtreeWithoutRoot(templateNote.noteId, note.noteId); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         else if (entity.type === 'label' && entity.name === 'sorted') { |         else if (entity.type === 'label' && ['sorted', 'sortDirection', 'sortFoldersFirst'].includes(entity.name)) { | ||||||
|             handleSortedAttribute(entity); |             handleSortedAttribute(entity); | ||||||
|         } |         } | ||||||
|         else if (entity.type === 'label') { |         else if (entity.type === 'label') { | ||||||
| @@ -110,6 +108,10 @@ eventService.subscribe(eventService.ENTITY_CREATED, ({ entityName, entity }) => | |||||||
|     } |     } | ||||||
|     else if (entityName === 'branches') { |     else if (entityName === 'branches') { | ||||||
|         runAttachedRelations(entity.getNote(), 'runOnBranchCreation', entity); |         runAttachedRelations(entity.getNote(), 'runOnBranchCreation', entity); | ||||||
|  |  | ||||||
|  |         if (entity.parentNote?.hasLabel("sorted")) { | ||||||
|  |             treeService.sortNotesIfNeeded(entity.parentNoteId); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     else if (entityName === 'notes') { |     else if (entityName === 'notes') { | ||||||
|         runAttachedRelations(entity, 'runOnNoteCreation', entity); |         runAttachedRelations(entity, 'runOnNoteCreation', entity); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user