mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	various small fixes
This commit is contained in:
		| @@ -294,7 +294,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte | |||||||
|      * @return {boolean} returns true if the original note is still loaded, false if user switched to another |      * @return {boolean} returns true if the original note is still loaded, false if user switched to another | ||||||
|      */ |      */ | ||||||
|     this.isNoteStillActive = () => { |     this.isNoteStillActive = () => { | ||||||
|         return this.originEntity.noteId === tabContext.noteId; |         return tabContext.note && this.originEntity.noteId === tabContext.note.noteId; | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -55,7 +55,7 @@ export default class LinkMap { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         // preload all notes |         // preload all notes | ||||||
|         const notes = await treeCache.getNotes(Array.from(noteIds)); |         const notes = await treeCache.getNotes(Array.from(noteIds), true); | ||||||
|  |  | ||||||
|         const graph = new Springy.Graph(); |         const graph = new Springy.Graph(); | ||||||
|         graph.addNodes(...noteIds); |         graph.addNodes(...noteIds); | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ function enterProtectedSession() { | |||||||
|         // using deferred instead of promise because it allows resolving from outside |         // using deferred instead of promise because it allows resolving from outside | ||||||
|         protectedSessionDeferred = dfd; |         protectedSessionDeferred = dfd; | ||||||
|  |  | ||||||
|         import("../dialogs/protected_session.js").then(protectedSessionDialog => protectedSessionDialog.show()) |         import("../dialogs/protected_session.js").then(dialog => dialog.show()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return dfd.promise(); |     return dfd.promise(); | ||||||
| @@ -51,7 +51,7 @@ async function setupProtectedSession(password) { | |||||||
|     await noteDetailService.reloadAllTabs(); |     await noteDetailService.reloadAllTabs(); | ||||||
|  |  | ||||||
|     if (protectedSessionDeferred !== null) { |     if (protectedSessionDeferred !== null) { | ||||||
|         protectedSessionDialog.close(); |         import("../dialogs/protected_session.js").then(dialog => dialog.close()); | ||||||
|  |  | ||||||
|         protectedSessionDeferred.resolve(true); |         protectedSessionDeferred.resolve(true); | ||||||
|         protectedSessionDeferred = null; |         protectedSessionDeferred = null; | ||||||
|   | |||||||
| @@ -135,6 +135,8 @@ class TabContext { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         this.$scriptArea.empty(); | ||||||
|  |  | ||||||
|         if (utils.isDesktop()) { |         if (utils.isDesktop()) { | ||||||
|             this.attributes.refreshAttributes(); |             this.attributes.refreshAttributes(); | ||||||
|         } else { |         } else { | ||||||
|   | |||||||
| @@ -818,8 +818,6 @@ $(window).bind('hashchange', async function() { | |||||||
|     if (isNotePathInAddress()) { |     if (isNotePathInAddress()) { | ||||||
|         const [notePath, tabId] = getHashValueFromAddress(); |         const [notePath, tabId] = getHashValueFromAddress(); | ||||||
|  |  | ||||||
|         console.debug(`Switching to ${notePath} on tab ${tabId} because of hash change`); |  | ||||||
|  |  | ||||||
|         noteDetailService.switchToTab(tabId, notePath); |         noteDetailService.switchToTab(tabId, notePath); | ||||||
|     } |     } | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -121,12 +121,12 @@ class TreeCache { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @return {Promise<NoteShort>} */ |     /** @return {Promise<NoteShort>} */ | ||||||
|     async getNote(noteId) { |     async getNote(noteId, silentNotFoundError = false) { | ||||||
|         if (noteId === 'none') { |         if (noteId === 'none') { | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return (await this.getNotes([noteId]))[0]; |         return (await this.getNotes([noteId], silentNotFoundError))[0]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     addBranch(branch) { |     addBranch(branch) { | ||||||
|   | |||||||
| @@ -28,19 +28,20 @@ class EditedNotesWidget extends StandardWidget { | |||||||
|  |  | ||||||
|         const noteIds = editedNotes.flatMap(note => note.notePath); |         const noteIds = editedNotes.flatMap(note => note.notePath); | ||||||
|  |  | ||||||
|         await treeCache.getNotes(noteIds); // preload all at once |         await treeCache.getNotes(noteIds, true); // preload all at once | ||||||
|  |  | ||||||
|         const $list = $('<ul>'); |         const $list = $('<ul>'); | ||||||
|  |  | ||||||
|         for (const editedNote of editedNotes) { |         for (const editedNote of editedNotes) { | ||||||
|             const note = await treeCache.getNote(editedNote.noteId); |             const note = await treeCache.getNote(editedNote.noteId, true); | ||||||
|  |             const $item = $("<li>"); | ||||||
|  |  | ||||||
|             if (!note) { |             if (!note) { | ||||||
|                 continue; |                 $item.append($("<i>").text(editedNote.title + " (deleted)")); | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 $item.append(editedNote.notePath ? await linkService.createNoteLinkWithPath(editedNote.notePath.join("/")) : editedNote.title); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             const $item = $("<li>") |  | ||||||
|                 .append(editedNote.notePath ? await linkService.createNoteLinkWithPath(editedNote.notePath.join("/")) : editedNote.title); |  | ||||||
|  |  | ||||||
|             $list.append($item); |             $list.append($item); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -21,12 +21,12 @@ class SimilarNotesWidget extends StandardWidget { | |||||||
|  |  | ||||||
|         const noteIds = similarNotes.flatMap(note => note.notePath); |         const noteIds = similarNotes.flatMap(note => note.notePath); | ||||||
|  |  | ||||||
|         await treeCache.getNotes(noteIds); // preload all at once |         await treeCache.getNotes(noteIds, true); // preload all at once | ||||||
|  |  | ||||||
|         const $list = $('<ul>'); |         const $list = $('<ul>'); | ||||||
|  |  | ||||||
|         for (const similarNote of similarNotes) { |         for (const similarNote of similarNotes) { | ||||||
|             const note = await treeCache.getNote(similarNote.noteId); |             const note = await treeCache.getNote(similarNote.noteId, true); | ||||||
|  |  | ||||||
|             if (!note) { |             if (!note) { | ||||||
|                 continue; |                 continue; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user