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