mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
converting note properties to methods
This commit is contained in:
parent
2451596e8c
commit
a093508fbe
@ -17,7 +17,7 @@ class NoteBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
label(name, value = '', isInheritable = false) {
|
label(name, value = '', isInheritable = false) {
|
||||||
new Attribute(becca, {
|
new Attribute({
|
||||||
attributeId: id(),
|
attributeId: id(),
|
||||||
noteId: this.note.noteId,
|
noteId: this.note.noteId,
|
||||||
type: 'label',
|
type: 'label',
|
||||||
@ -30,7 +30,7 @@ class NoteBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
relation(name, targetNote) {
|
relation(name, targetNote) {
|
||||||
new Attribute(becca, {
|
new Attribute({
|
||||||
attributeId: id(),
|
attributeId: id(),
|
||||||
noteId: this.note.noteId,
|
noteId: this.note.noteId,
|
||||||
type: 'relation',
|
type: 'relation',
|
||||||
|
@ -9,7 +9,7 @@ function isNotePathArchived(notePath) {
|
|||||||
const noteId = notePath[notePath.length - 1];
|
const noteId = notePath[notePath.length - 1];
|
||||||
const note = becca.notes[noteId];
|
const note = becca.notes[noteId];
|
||||||
|
|
||||||
if (note.isArchived()) {
|
if (note.isArchived) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ function getNoteTitleForPath(notePathArray) {
|
|||||||
* Returns notePath for noteId from cache. Note hoisting is respected.
|
* Returns notePath for noteId from cache. Note hoisting is respected.
|
||||||
* Archived notes are also returned, but non-archived paths are preferred if available
|
* 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
|
* - 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 = []) {
|
function getSomePath(note, path = []) {
|
||||||
// first try to find note within hoisted note, otherwise take any existing 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;
|
return attrs.length > 0 ? attrs[0] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
isArchived() {
|
get isArchived() {
|
||||||
return this.hasAttribute('label', 'archived');
|
return this.hasAttribute('label', 'archived');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,8 +308,8 @@ class NoteShort {
|
|||||||
return a.isInHoistedSubTree ? -1 : 1;
|
return a.isInHoistedSubTree ? -1 : 1;
|
||||||
} else if (a.isSearch !== b.isSearch) {
|
} else if (a.isSearch !== b.isSearch) {
|
||||||
return a.isSearch ? 1 : -1;
|
return a.isSearch ? 1 : -1;
|
||||||
} else if (a.isArchived() !== b.isArchived()) {
|
} else if (a.isArchived !== b.isArchived) {
|
||||||
return a.isArchived() ? 1 : -1;
|
return a.isArchived ? 1 : -1;
|
||||||
} else {
|
} else {
|
||||||
return a.notePath.length - b.notePath.length;
|
return a.notePath.length - b.notePath.length;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,9 @@ class ZoomService extends Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("wheel", event => {
|
window.addEventListener("wheel", event => {
|
||||||
|
if (event.ctrlKey) {
|
||||||
this.setZoomFactorAndSave(this.getCurrentZoom() + event.deltaY * 0.001);
|
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>`);
|
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");
|
$noteLink.addClass("path-archived");
|
||||||
|
|
||||||
icons.push(`<span class="bx bx-archive" title="Archived"></span>`);
|
icons.push(`<span class="bx bx-archive" title="Archived"></span>`);
|
||||||
|
@ -47,10 +47,11 @@ function updateNoteAttribute(req) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute = new Attribute();
|
attribute = new Attribute({
|
||||||
attribute.noteId = noteId;
|
noteId: noteId,
|
||||||
attribute.name = body.name;
|
name: body.name,
|
||||||
attribute.type = body.type;
|
type: body.type
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attribute.type === 'label' || body.value.trim()) {
|
if (attribute.type === 'label' || body.value.trim()) {
|
||||||
|
@ -153,6 +153,8 @@ function findResultsWithQuery(query, searchContext) {
|
|||||||
|
|
||||||
const expression = parseQueryToExpression(query, searchContext);
|
const expression = parseQueryToExpression(query, searchContext);
|
||||||
|
|
||||||
|
console.log("expression", expression);
|
||||||
|
|
||||||
if (!expression) {
|
if (!expression) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user