mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	export root note fix, #2346
This commit is contained in:
		@@ -32,7 +32,7 @@ export default class TreeContextMenu {
 | 
				
			|||||||
        const isHoisted = note.noteId === appContext.tabManager.getActiveContext().hoistedNoteId;
 | 
					        const isHoisted = note.noteId === appContext.tabManager.getActiveContext().hoistedNoteId;
 | 
				
			||||||
        const parentNote = isNotRoot ? await froca.getNote(branch.parentNoteId) : null;
 | 
					        const parentNote = isNotRoot ? await froca.getNote(branch.parentNoteId) : null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // some actions don't support multi-note so they are disabled when notes are selected
 | 
					        // some actions don't support multi-note, so they are disabled when notes are selected
 | 
				
			||||||
        // the only exception is when the only selected note is the one that was right-clicked, then
 | 
					        // the only exception is when the only selected note is the one that was right-clicked, then
 | 
				
			||||||
        // it's clear what the user meant to do.
 | 
					        // it's clear what the user meant to do.
 | 
				
			||||||
        const selNodes = this.treeWidget.getSelectedNodes();
 | 
					        const selNodes = this.treeWidget.getSelectedNodes();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -216,7 +216,7 @@ class Froca {
 | 
				
			|||||||
    getNotesFromCache(noteIds, silentNotFoundError = false) {
 | 
					    getNotesFromCache(noteIds, silentNotFoundError = false) {
 | 
				
			||||||
        return noteIds.map(noteId => {
 | 
					        return noteIds.map(noteId => {
 | 
				
			||||||
            if (!this.notes[noteId] && !silentNotFoundError) {
 | 
					            if (!this.notes[noteId] && !silentNotFoundError) {
 | 
				
			||||||
                console.trace(`Can't find note "${noteId}"`);
 | 
					                console.trace(`Can't find note '${noteId}'`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return null;
 | 
					                return null;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -235,7 +235,7 @@ class Froca {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return noteIds.map(noteId => {
 | 
					        return noteIds.map(noteId => {
 | 
				
			||||||
            if (!this.notes[noteId] && !silentNotFoundError) {
 | 
					            if (!this.notes[noteId] && !silentNotFoundError) {
 | 
				
			||||||
                console.trace(`Can't find note "${noteId}"`);
 | 
					                console.trace(`Can't find note '${noteId}'`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return null;
 | 
					                return null;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
@@ -285,7 +285,7 @@ class Froca {
 | 
				
			|||||||
    getBranch(branchId, silentNotFoundError = false) {
 | 
					    getBranch(branchId, silentNotFoundError = false) {
 | 
				
			||||||
        if (!(branchId in this.branches)) {
 | 
					        if (!(branchId in this.branches)) {
 | 
				
			||||||
            if (!silentNotFoundError) {
 | 
					            if (!silentNotFoundError) {
 | 
				
			||||||
                logError(`Not existing branch ${branchId}`);
 | 
					                logError(`Not existing branch '${branchId}'`);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
@@ -295,13 +295,13 @@ class Froca {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    async getBranchId(parentNoteId, childNoteId) {
 | 
					    async getBranchId(parentNoteId, childNoteId) {
 | 
				
			||||||
        if (childNoteId === 'root') {
 | 
					        if (childNoteId === 'root') {
 | 
				
			||||||
            return 'root';
 | 
					            return 'none_root';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const child = await this.getNote(childNoteId);
 | 
					        const child = await this.getNote(childNoteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!child) {
 | 
					        if (!child) {
 | 
				
			||||||
            logError(`Could not find branchId for parent=${parentNoteId}, child=${childNoteId} since child does not exist`);
 | 
					            logError(`Could not find branchId for parent '${parentNoteId}', child '${childNoteId}' since child does not exist`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return null;
 | 
					            return null;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -318,9 +318,9 @@ class Froca {
 | 
				
			|||||||
                .then(row => new NoteComplement(row))
 | 
					                .then(row => new NoteComplement(row))
 | 
				
			||||||
                .catch(e => console.error(`Cannot get note complement for note '${noteId}'`));
 | 
					                .catch(e => console.error(`Cannot get note complement for note '${noteId}'`));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // we don't want to keep large payloads forever in memory so we clean that up quite quickly
 | 
					            // we don't want to keep large payloads forever in memory, so we clean that up quite quickly
 | 
				
			||||||
            // this cache is more meant to share the data between different components within one business transaction (e.g. loading of the note into the tab context and all the components)
 | 
					            // this cache is more meant to share the data between different components within one business transaction (e.g. loading of the note into the tab context and all the components)
 | 
				
			||||||
            // this is also a work around for missing invalidation after change
 | 
					            // this is also a workaround for missing invalidation after change
 | 
				
			||||||
            this.noteComplementPromises[noteId].then(
 | 
					            this.noteComplementPromises[noteId].then(
 | 
				
			||||||
                () => setTimeout(() => this.noteComplementPromises[noteId] = null, 1000)
 | 
					                () => setTimeout(() => this.noteComplementPromises[noteId] = null, 1000)
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ function exportBranch(req, res) {
 | 
				
			|||||||
    const branch = becca.getBranch(branchId);
 | 
					    const branch = becca.getBranch(branchId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!branch) {
 | 
					    if (!branch) {
 | 
				
			||||||
        const message = `Cannot export branch ${branchId} since it does not exist.`;
 | 
					        const message = `Cannot export branch '${branchId}' since it does not exist.`;
 | 
				
			||||||
        log.error(message);
 | 
					        log.error(message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        res.setHeader("Content-Type", "text/plain")
 | 
					        res.setHeader("Content-Type", "text/plain")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user