mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	converting note properties to methods
This commit is contained in:
		| @@ -17,7 +17,7 @@ class NoteBuilder { | ||||
|     } | ||||
|  | ||||
|     label(name, value = '', isInheritable = false) { | ||||
|         new Attribute(becca, { | ||||
|         new Attribute({ | ||||
|             attributeId: id(), | ||||
|             noteId: this.note.noteId, | ||||
|             type: 'label', | ||||
| @@ -30,7 +30,7 @@ class NoteBuilder { | ||||
|     } | ||||
|  | ||||
|     relation(name, targetNote) { | ||||
|         new Attribute(becca, { | ||||
|         new Attribute({ | ||||
|             attributeId: id(), | ||||
|             noteId: this.note.noteId, | ||||
|             type: 'relation', | ||||
|   | ||||
| @@ -9,7 +9,7 @@ function isNotePathArchived(notePath) { | ||||
|     const noteId = notePath[notePath.length - 1]; | ||||
|     const note = becca.notes[noteId]; | ||||
|  | ||||
|     if (note.isArchived()) { | ||||
|     if (note.isArchived) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @@ -123,7 +123,7 @@ function getNoteTitleForPath(notePathArray) { | ||||
|  * Returns notePath for noteId from cache. Note hoisting is respected. | ||||
|  * Archived notes are also returned, but non-archived paths are preferred if available | ||||
|  * - this means that archived paths is returned only if there's no non-archived path | ||||
|  * - you can check whether returned path is archived using isArchived() | ||||
|  * - you can check whether returned path is archived using isArchived | ||||
|  */ | ||||
| function getSomePath(note, path = []) { | ||||
|     // first try to find note within hoisted note, otherwise take any existing note path | ||||
|   | ||||
| @@ -568,7 +568,7 @@ class Note extends AbstractEntity { | ||||
|         return attrs.length > 0 ? attrs[0] : null; | ||||
|     } | ||||
|  | ||||
|     isArchived() { | ||||
|     get isArchived() { | ||||
|         return this.hasAttribute('label', 'archived'); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -308,8 +308,8 @@ class NoteShort { | ||||
|                 return a.isInHoistedSubTree ? -1 : 1; | ||||
|             } else if (a.isSearch !== b.isSearch) { | ||||
|                 return a.isSearch ? 1 : -1; | ||||
|             } else if (a.isArchived() !== b.isArchived()) { | ||||
|                 return a.isArchived() ? 1 : -1; | ||||
|             } else if (a.isArchived !== b.isArchived) { | ||||
|                 return a.isArchived ? 1 : -1; | ||||
|             } else { | ||||
|                 return a.notePath.length - b.notePath.length; | ||||
|             } | ||||
|   | ||||
| @@ -15,7 +15,9 @@ class ZoomService extends Component { | ||||
|             }); | ||||
|  | ||||
|             window.addEventListener("wheel", event => { | ||||
|                 if (event.ctrlKey) { | ||||
|                     this.setZoomFactorAndSave(this.getCurrentZoom() + event.deltaY * 0.001); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -100,7 +100,7 @@ export default class NotePathsWidget extends TabAwareWidget { | ||||
|             icons.push(`<span class="bx bx-trending-up" title="This path is outside of hoisted note and you would have to unhoist."></span>`); | ||||
|         } | ||||
|  | ||||
|         if (notePathRecord.isArchived()) { | ||||
|         if (notePathRecord.isArchived) { | ||||
|             $noteLink.addClass("path-archived"); | ||||
|  | ||||
|             icons.push(`<span class="bx bx-archive" title="Archived"></span>`); | ||||
|   | ||||
| @@ -47,10 +47,11 @@ function updateNoteAttribute(req) { | ||||
|             return {}; | ||||
|         } | ||||
|  | ||||
|         attribute = new Attribute(); | ||||
|         attribute.noteId = noteId; | ||||
|         attribute.name = body.name; | ||||
|         attribute.type = body.type; | ||||
|         attribute = new Attribute({ | ||||
|             noteId: noteId, | ||||
|             name: body.name, | ||||
|             type: body.type | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     if (attribute.type === 'label' || body.value.trim()) { | ||||
|   | ||||
| @@ -153,6 +153,8 @@ function findResultsWithQuery(query, searchContext) { | ||||
|  | ||||
|     const expression = parseQueryToExpression(query, searchContext); | ||||
|  | ||||
|     console.log("expression", expression); | ||||
|  | ||||
|     if (!expression) { | ||||
|         return []; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user