Skip to content

Build your personal knowledge base with Trilium Notes

jsdoc @param => @type

zadamda74272f13a5
diff --git a/src/becca/entities/attribute.js b/src/becca/entities/attribute.js
index 3fccd27f75..91f75d15fe 100644
--- a/src/becca/entities/attribute.js
+++ b/src/becca/entities/attribute.js
@@ -36,21 +36,21 @@ class Attribute extends AbstractEntity {
}
update([attributeId, noteId, type, name, value, isInheritable, position, utcDateModified]) {
- /** @param {string} */
+ /** @type {string} */
this.attributeId = attributeId;
- /** @param {string} */
+ /** @type {string} */
this.noteId = noteId;
- /** @param {string} */
+ /** @type {string} */
this.type = type;
- /** @param {string} */
+ /** @type {string} */
this.name = name;
- /** @param {int} */
+ /** @type {int} */
this.position = position;
- /** @param {string} */
+ /** @type {string} */
this.value = value;
- /** @param {boolean} */
+ /** @type {boolean} */
this.isInheritable = !!isInheritable;
- /** @param {string} */
+ /** @type {string} */
this.utcDateModified = utcDateModified;
return this;
diff --git a/src/becca/entities/branch.js b/src/becca/entities/branch.js
index 0ab9601168..159622fddf 100644
--- a/src/becca/entities/branch.js
+++ b/src/becca/entities/branch.js
@@ -35,19 +35,19 @@ class Branch extends AbstractEntity {
}
update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) {
- /** @param {string} */
+ /** @type {string} */
this.branchId = branchId;
- /** @param {string} */
+ /** @type {string} */
this.noteId = noteId;
- /** @param {string} */
+ /** @type {string} */
this.parentNoteId = parentNoteId;
- /** @param {string} */
+ /** @type {string} */
this.prefix = prefix;
- /** @param {int} */
+ /** @type {int} */
this.notePosition = notePosition;
- /** @param {boolean} */
+ /** @type {boolean} */
this.isExpanded = !!isExpanded;
- /** @param {string} */
+ /** @type {string} */
this.utcDateModified = utcDateModified;
return this;
diff --git a/src/becca/entities/note_revision.js b/src/becca/entities/note_revision.js
index dce539e765..1dd6aceef7 100644
--- a/src/becca/entities/note_revision.js
+++ b/src/becca/entities/note_revision.js
@@ -19,29 +19,29 @@ class NoteRevision extends AbstractEntity {
constructor(row) {
super();
- /** @param {string} */
+ /** @type {string} */
this.noteRevisionId = row.noteRevisionId;
- /** @param {string} */
+ /** @type {string} */
this.noteId = row.noteId;
- /** @param {string} */
+ /** @type {string} */
this.type = row.type;
- /** @param {string} */
+ /** @type {string} */
this.mime = row.mime;
- /** @param {boolean} */
+ /** @type {boolean} */
this.isProtected = !!row.isProtected;
- /** @param {string} */
+ /** @type {string} */
this.title = row.title;
- /** @param {string} */
+ /** @type {string} */
this.dateLastEdited = row.dateLastEdited;
- /** @param {string} */
+ /** @type {string} */
this.dateCreated = row.dateCreated;
- /** @param {string} */
+ /** @type {string} */
this.utcDateLastEdited = row.utcDateLastEdited;
- /** @param {string} */
+ /** @type {string} */
this.utcDateCreated = row.utcDateCreated;
- /** @param {string} */
+ /** @type {string} */
this.utcDateModified = row.utcDateModified;
- /** @param {number} */
+ /** @type {number} */
this.contentLength = row.contentLength;
if (this.isProtected) {
diff --git a/src/public/app/entities/attribute.js b/src/public/app/entities/attribute.js
index 126ad4797e..99c5416eb7 100644
--- a/src/public/app/entities/attribute.js
+++ b/src/public/app/entities/attribute.js
@@ -8,19 +8,19 @@ class Attribute {
}
update(row) {
- /** @param {string} attributeId */
+ /** @type {string} attributeId */
this.attributeId = row.attributeId;
- /** @param {string} noteId */
+ /** @type {string} noteId */
this.noteId = row.noteId;
- /** @param {string} type */
+ /** @type {string} type */
this.type = row.type;
- /** @param {string} name */
+ /** @type {string} name */
this.name = row.name;
- /** @param {string} value */
+ /** @type {string} value */
this.value = row.value;
- /** @param {int} position */
+ /** @type {int} position */
this.position = row.position;
- /** @param {boolean} isInheritable */
+ /** @type {boolean} isInheritable */
this.isInheritable = !!row.isInheritable;
}
diff --git a/src/public/app/entities/branch.js b/src/public/app/entities/branch.js
index 27802623e4..14fa4951bf 100644
--- a/src/public/app/entities/branch.js
+++ b/src/public/app/entities/branch.js
@@ -7,19 +7,19 @@ class Branch {
}
update(row) {
- /** @param {string} primary key */
+ /** @type {string} primary key */
this.branchId = row.branchId;
- /** @param {string} */
+ /** @type {string} */
this.noteId = row.noteId;
- /** @param {string} */
+ /** @type {string} */
this.parentNoteId = row.parentNoteId;
- /** @param {int} */
+ /** @type {int} */
this.notePosition = row.notePosition;
- /** @param {string} */
+ /** @type {string} */
this.prefix = row.prefix;
- /** @param {boolean} */
+ /** @type {boolean} */
this.isExpanded = !!row.isExpanded;
- /** @param {boolean} */
+ /** @type {boolean} */
this.fromSearchNote = !!row.fromSearchNote;
}
diff --git a/src/public/app/entities/note_complement.js b/src/public/app/entities/note_complement.js
index 5257c9d9a7..639f916559 100644
--- a/src/public/app/entities/note_complement.js
+++ b/src/public/app/entities/note_complement.js
@@ -3,35 +3,35 @@
*/
class NoteComplement {
constructor(row) {
- /** @param {string} */
+ /** @type {string} */
this.noteId = row.noteId;
/**
- * @param {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
+ * @type {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
*/
this.content = row.content;
- /** @param {int} */
+ /** @type {int} */
this.contentLength = row.contentLength;
- /** @param {string} */
+ /** @type {string} */
this.dateCreated = row.dateCreated;
- /** @param {string} */
+ /** @type {string} */
this.dateModified = row.dateModified;
- /** @param {string} */
+ /** @type {string} */
this.utcDateCreated = row.utcDateCreated;
- /** @param {string} */
+ /** @type {string} */
this.utcDateModified = row.utcDateModified;
// "combined" date modified give larger out of note's and note_content's dateModified
- /** @param {string} */
+ /** @type {string} */
this.combinedDateModified = row.combinedDateModified;
- /** @param {string} */
+ /** @type {string} */
this.combinedUtcDateModified = row.combinedUtcDateModified;
}
}
diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js
index 18537d7a48..1e3494030e 100644
--- a/src/public/app/entities/note_short.js
+++ b/src/public/app/entities/note_short.js
@@ -53,15 +53,15 @@ class NoteShort {
}
update(row) {
- /** @param {string} */
+ /** @type {string} */
this.noteId = row.noteId;
- /** @param {string} */
+ /** @type {string} */
this.title = row.title;
- /** @param {boolean} */
+ /** @type {boolean} */
this.isProtected = !!row.isProtected;
- /** @param {string} one of 'text', 'code', 'file' or 'render' */
+ /** @type {string} one of 'text', 'code', 'file' or 'render' */
this.type = row.type;
- /** @param {string} content-type, e.g. "application/json" */
+ /** @type {string} content-type, e.g. "application/json" */
this.mime = row.mime;
}
@@ -678,7 +678,7 @@ class NoteShort {
return await this.froca.getNoteComplement(this.noteId);
}
- get toString() {
+ toString() {
return `Note(noteId=${this.noteId}, title=${this.title})`;
}
diff --git a/src/public/app/services/tree.js b/src/public/app/services/tree.js
index b6b30071c1..7bed9a7a98 100644
--- a/src/public/app/services/tree.js
+++ b/src/public/app/services/tree.js
@@ -106,6 +106,10 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
const someNotePathSegments = getSomeNotePathSegments(note, hoistedNoteId);
+ if (!someNotePathSegments) {
+ throw new Error(`Did not find any path segments for ${note.toString()}, hoisted note ${hoistedNoteId}`);
+ }
+
// if there isn't actually any note path with hoisted note then return the original resolved note path
return someNotePathSegments.includes(hoistedNoteId) ? someNotePathSegments : effectivePathSegments;
}
diff --git a/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.js b/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.js
index cb91cae8a4..c71d0508ca 100644
--- a/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.js
+++ b/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.js
@@ -33,6 +33,7 @@ export default class InheritedAttributesWidget extends NoteContextAwareWidget {
constructor() {
super();
+ /** @type {AttributeDetailWidget} */
this.attributeDetailWidget = new AttributeDetailWidget().setParent(this);
this.child(this.attributeDetailWidget);
}
@@ -65,18 +66,21 @@ export default class InheritedAttributesWidget extends NoteContextAwareWidget {
for (const attribute of inheritedAttributes) {
const $attr = (await attributeRenderer.renderAttribute(attribute, false))
- .on('click', e => this.attributeDetailWidget.showAttributeDetail({
- attribute: {
- noteId: attribute.noteId,
- type: attribute.type,
- name: attribute.name,
- value: attribute.value,
- isInheritable: attribute.isInheritable
- },
- isOwned: false,
- x: e.pageX,
- y: e.pageY
- }));
+ .on('click', e => {
+ setTimeout(() =>
+ this.attributeDetailWidget.showAttributeDetail({
+ attribute: {
+ noteId: attribute.noteId,
+ type: attribute.type,
+ name: attribute.name,
+ value: attribute.value,
+ isInheritable: attribute.isInheritable
+ },
+ isOwned: false,
+ x: e.pageX,
+ y: e.pageY
+ }), 100);
+ });
this.$container
.append($attr)