mirror of
https://github.com/zadam/trilium.git
synced 2025-01-15 19:51:57 +08:00
jsdoc @param => @type
This commit is contained in:
parent
9ce224d4c5
commit
da74272f13
9 changed files with 76 additions and 68 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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})`;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue