diff --git a/docs/backend_api/BAttribute.html b/docs/backend_api/BAttribute.html index 8c693765f..d7d1447f7 100644 --- a/docs/backend_api/BAttribute.html +++ b/docs/backend_api/BAttribute.html @@ -490,7 +490,7 @@ and relation (representing named relationship between source and target note)position :integer +
api.log(api.startNote.
- where script is currently executing. Don't mix this up with concept of active note
+ where the script is currently executing. Don't mix this up with the concept of active note
@@ -643,7 +643,7 @@ available in the JS backend notes. You can use e.g. api.log(api.startNote.
- whose event triggered this executions
+ whose event triggered this execution
@@ -863,7 +863,7 @@ available in the JS backend notes. You can use e.g. api.log(api.startNote.
- where script started executing
+ where the script started executing
@@ -1623,7 +1623,7 @@ JSON MIME type. See also createNewNote() for more options.
-integer
+int
@@ -3360,7 +3360,7 @@ JSON MIME type. See also createNewNote() for more options.
- if branch will be created between note and parent note, set this prefix
+ if branch is created between note and parent note, set this prefix
@@ -6272,7 +6272,7 @@ if some action needs to happen on only one specific instance.
-integer
+int
@@ -7463,7 +7463,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
- if branch will be created between note and parent note, set this prefix
+ if branch is created between note and parent note, set this prefix
diff --git a/docs/backend_api/becca_entities_battribute.js.html b/docs/backend_api/becca_entities_battribute.js.html
index 8890189fa..ace7179e5 100644
--- a/docs/backend_api/becca_entities_battribute.js.html
+++ b/docs/backend_api/becca_entities_battribute.js.html
@@ -79,7 +79,7 @@ class BAttribute extends AbstractBeccaEntity {
this.type = type;
/** @type {string} */
this.name = name;
- /** @type {integer} */
+ /** @type {int} */
this.position = position;
/** @type {string} */
this.value = value || "";
diff --git a/docs/backend_api/becca_entities_bbranch.js.html b/docs/backend_api/becca_entities_bbranch.js.html
index 8e8282cc0..bf234d8aa 100644
--- a/docs/backend_api/becca_entities_bbranch.js.html
+++ b/docs/backend_api/becca_entities_bbranch.js.html
@@ -83,7 +83,7 @@ class BBranch extends AbstractBeccaEntity {
this.parentNoteId = parentNoteId;
/** @type {string|null} */
this.prefix = prefix;
- /** @type {integer} */
+ /** @type {int} */
this.notePosition = notePosition;
/** @type {boolean} */
this.isExpanded = !!isExpanded;
diff --git a/docs/backend_api/becca_entities_bnote.js.html b/docs/backend_api/becca_entities_bnote.js.html
index 6c7d41cb2..038c64e75 100644
--- a/docs/backend_api/becca_entities_bnote.js.html
+++ b/docs/backend_api/becca_entities_bnote.js.html
@@ -46,7 +46,7 @@ const LABEL = 'label';
const RELATION = 'relation';
/**
- * Trilium's main entity which can represent text note, image, code note, file attachment etc.
+ * Trilium's main entity, which can represent text note, image, code note, file attachment etc.
*
* @extends AbstractBeccaEntity
*/
@@ -151,7 +151,7 @@ class BNote extends AbstractBeccaEntity {
* @private */
this.__ancestorCache = null;
- // following attributes are filled during searching from database
+ // following attributes are filled during searching in the database
/**
* size of the content in bytes
@@ -594,7 +594,8 @@ class BNote extends AbstractBeccaEntity {
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
- * @returns {BAttribute} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
+ * @returns {BAttribute} attribute of the given type and name. If there are more such attributes, first is returned.
+ * Returns null if there's no such attribute belonging to this note.
*/
getAttribute(type, name) {
const attributes = this.getAttributes();
@@ -694,7 +695,7 @@ class BNote extends AbstractBeccaEntity {
return this.ownedAttributes.filter(attr => attr.name === name);
}
else {
- return this.ownedAttributes.slice();
+ return this.ownedAttributes;
}
}
@@ -716,7 +717,7 @@ class BNote extends AbstractBeccaEntity {
areAllNotePathsArchived() {
// there's a slight difference between note being itself archived and all its note paths being archived
// - note is archived when it itself has an archived label or inherits it
- // - note does not have or inherit archived label, but each note paths contains a note with (non-inheritable)
+ // - note does not have or inherit archived label, but each note path contains a note with (non-inheritable)
// archived label
const bestNotePathRecord = this.getSortedNotePathRecords()[0];
@@ -1121,16 +1122,16 @@ class BNote extends AbstractBeccaEntity {
/** @returns {BAttachment[]} */
getAttachments(opts = {}) {
opts.includeContentLength = !!opts.includeContentLength;
- // from testing it looks like calculating length does not make a difference in performance even on large-ish DB
+ // from testing, it looks like calculating length does not make a difference in performance even on large-ish DB
// given that we're always fetching attachments only for a specific note, we might just do it always
const query = opts.includeContentLength
? `SELECT attachments.*, LENGTH(blobs.content) AS contentLength
FROM attachments
JOIN blobs USING (blobId)
- WHERE parentId = ? AND isDeleted = 0
+ WHERE ownerId = ? AND isDeleted = 0
ORDER BY position`
- : `SELECT * FROM attachments WHERE parentId = ? AND isDeleted = 0 ORDER BY position`;
+ : `SELECT * FROM attachments WHERE ownerId = ? AND isDeleted = 0 ORDER BY position`;
return sql.getRows(query, [this.noteId])
.map(row => new BAttachment(row));
@@ -1144,8 +1145,8 @@ class BNote extends AbstractBeccaEntity {
? `SELECT attachments.*, LENGTH(blobs.content) AS contentLength
FROM attachments
JOIN blobs USING (blobId)
- WHERE parentId = ? AND attachmentId = ? AND isDeleted = 0`
- : `SELECT * FROM attachments WHERE parentId = ? AND attachmentId = ? AND isDeleted = 0`;
+ WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0`
+ : `SELECT * FROM attachments WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0`;
return sql.getRows(query, [this.noteId, attachmentId])
.map(row => new BAttachment(row))[0];
@@ -1156,7 +1157,7 @@ class BNote extends AbstractBeccaEntity {
return sql.getRows(`
SELECT attachments.*
FROM attachments
- WHERE parentId = ?
+ WHERE ownerId = ?
AND role = ?
AND isDeleted = 0
ORDER BY position`, [this.noteId, role])
@@ -1176,7 +1177,7 @@ class BNote extends AbstractBeccaEntity {
const parentNotes = this.getParentNotes();
const notePaths = parentNotes.length === 1
- ? parentNotes[0].getAllNotePaths() // optimization for most common case
+ ? parentNotes[0].getAllNotePaths() // optimization for the most common case
: parentNotes.flatMap(parentNote => parentNote.getAllNotePaths());
for (const notePath of notePaths) {
@@ -1216,7 +1217,7 @@ class BNote extends AbstractBeccaEntity {
}
/**
- * Returns note path considered to be the "best"
+ * Returns a note path considered to be the "best"
*
* @param {string} [hoistedNoteId='root']
* @return {string[]} array of noteIds constituting the particular note path
@@ -1226,7 +1227,7 @@ class BNote extends AbstractBeccaEntity {
}
/**
- * Returns note path considered to be the "best"
+ * Returns a note path considered to be the "best"
*
* @param {string} [hoistedNoteId='root']
* @return {string} serialized note path (e.g. 'root/a1h315/js725h')
@@ -1366,7 +1367,7 @@ class BNote extends AbstractBeccaEntity {
}
/**
- * Based on enabled, attribute is either set or removed.
+ * Based on enabled, the attribute is either set or removed.
*
* @param {string} type - attribute type ('relation', 'label' etc.)
* @param {boolean} enabled - toggle On or Off
@@ -1425,7 +1426,7 @@ class BNote extends AbstractBeccaEntity {
removeLabel(name, value) { return this.removeAttribute(LABEL, name, value); }
/**
- * Remove relation name-value pair, if it exists.
+ * Remove the relation name-value pair, if it exists.
*
* @param {string} name - relation name
* @param {string} [value] - relation value (noteId)
@@ -1454,14 +1455,16 @@ class BNote extends AbstractBeccaEntity {
return cloningService.cloneNoteToBranch(this.noteId, branch.branchId);
}
- isEligibleForConversionToAttachment() {
+ isEligibleForConversionToAttachment(opts = {autoConversion: false}) {
if (this.type !== 'image' || !this.isContentAvailable() || this.hasChildren() || this.getParentBranches().length !== 1) {
return false;
}
const targetRelations = this.getTargetRelations().filter(relation => relation.name === 'imageLink');
- if (targetRelations.length > 1) {
+ if (opts.autoConversion && targetRelations.length === 0) {
+ return false;
+ } else if (targetRelations.length > 1) {
return false;
}
@@ -1483,21 +1486,21 @@ class BNote extends AbstractBeccaEntity {
* - it has a relation from its parent note
* - it has no children
* - it has no clones
- * - parent is of type text
+ * - the parent is of type text
* - both notes are either unprotected or user is in protected session
*
* Currently, works only for image notes.
*
- * In future this functionality might get more generic and some of the requirements relaxed.
+ * In the future, this functionality might get more generic and some of the requirements relaxed.
*
* @params {Object} [opts]
- * @params {bolean} [opts.force=false} it is envisioned that user can force the conversion even if some conditions
- * are not satisfied (e.g. relation to parent doesn't exist).
+ * @params {bolean} [opts.autoConversion=false} if true, the action is not triggered by user, but e.g. by migration,
+ * and only perfect candidates will be migrated
*
* @returns {BAttachment|null} - null if note is not eligible for conversion
*/
- convertToParentAttachment(opts = {force: false}) {
- if (!this.isEligibleForConversionToAttachment()) {
+ convertToParentAttachment(opts = {autoConversion: false}) {
+ if (!this.isEligibleForConversionToAttachment(opts)) {
return null;
}
@@ -1520,6 +1523,9 @@ class BNote extends AbstractBeccaEntity {
parentNote.setContent(fixedContent);
+ const noteService = require("../../services/notes");
+ noteService.asyncPostProcessContent(parentNote, fixedContent); // to mark an unused attachment for deletion
+
this.deleteNote();
return attachment;
@@ -1577,7 +1583,7 @@ class BNote extends AbstractBeccaEntity {
}
get isDeleted() {
- // isBeingDeleted is relevant only in the transition period when the deletion process have begun, but not yet
+ // isBeingDeleted is relevant only in the transition period when the deletion process has begun, but not yet
// finished (note is still in becca)
return !(this.noteId in this.becca.notes) || this.isBeingDeleted;
}
@@ -1617,11 +1623,15 @@ class BNote extends AbstractBeccaEntity {
}
const revisionAttachment = noteAttachment.copy();
- revisionAttachment.parentId = revision.revisionId;
+ revisionAttachment.ownerId = revision.revisionId;
revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});
// content is rewritten to point to the revision attachments
- noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, `attachments/${revisionAttachment.attachmentId}`);
+ noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`,
+ `attachments/${revisionAttachment.attachmentId}`);
+
+ noteContent = noteContent.replaceAll(new RegExp(`href="[^"]*attachmentId=${noteAttachment.attachmentId}[^"]*"`, 'gi'),
+ `href="api/attachments/${revisionAttachment.attachmentId}/download"`);
}
revision.setContent(noteContent, {forceSave: true});
@@ -1641,7 +1651,7 @@ class BNote extends AbstractBeccaEntity {
attachment = this.becca.getAttachmentOrThrow(attachmentId);
} else {
attachment = new BAttachment({
- parentId: this.noteId,
+ ownerId: this.noteId,
title,
role,
mime,
diff --git a/docs/backend_api/becca_entities_boption.js.html b/docs/backend_api/becca_entities_boption.js.html
index a6dfc490a..290740727 100644
--- a/docs/backend_api/becca_entities_boption.js.html
+++ b/docs/backend_api/becca_entities_boption.js.html
@@ -32,7 +32,7 @@ const dateUtils = require('../../services/date_utils');
const AbstractBeccaEntity = require("./abstract_becca_entity");
/**
- * Option represents name-value pair, either directly configurable by the user or some system property.
+ * Option represents a name-value pair, either directly configurable by the user or some system property.
*
* @extends AbstractBeccaEntity
*/
diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html
index ad5eb02f4..d33d0df11 100644
--- a/docs/backend_api/services_backend_script_api.js.html
+++ b/docs/backend_api/services_backend_script_api.js.html
@@ -55,11 +55,11 @@ const exportService = require("./export/zip");
* @constructor
*/
function BackendScriptApi(currentNote, apiParams) {
- /** @property {BNote} note where script started executing */
+ /** @property {BNote} note where the script started executing */
this.startNote = apiParams.startNote;
- /** @property {BNote} note where script is currently executing. Don't mix this up with concept of active note */
+ /** @property {BNote} note where the script is currently executing. Don't mix this up with the concept of active note */
this.currentNote = currentNote;
- /** @property {AbstractBeccaEntity} entity whose event triggered this executions */
+ /** @property {AbstractBeccaEntity} entity whose event triggered this execution */
this.originEntity = apiParams.originEntity;
for (const key in apiParams) {
@@ -170,7 +170,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @method
* @param {string} noteId
* @param {string} parentNoteId
- * @param {string} prefix - if branch will be created between note and parent note, set this prefix
+ * @param {string} prefix - if branch is created between note and parent note, set this prefix
* @returns {{branch: BBranch|null}}
*/
this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent;
@@ -192,7 +192,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @param {boolean} present - true if we want the branch to exist, false if we want it gone
* @param {string} noteId
* @param {string} parentNoteId
- * @param {string} prefix - if branch will be created between note and parent note, set this prefix
+ * @param {string} prefix - if branch is created between note and parent note, set this prefix
* @returns {void}
*/
this.toggleNoteInParent = cloningService.toggleNoteInParent;
@@ -243,7 +243,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @property {boolean} [params.isProtected=false]
* @property {boolean} [params.isExpanded=false]
* @property {string} [params.prefix='']
- * @property {integer} [params.notePosition] - default is last existing notePosition in a parent + 10
+ * @property {int} [params.notePosition] - default is last existing notePosition in a parent + 10
* @returns {{note: BNote, branch: BBranch}} object contains newly created entities note and branch
*/
this.createNewNote = noteService.createNewNote;
@@ -272,7 +272,7 @@ function BackendScriptApi(currentNote, apiParams) {
const parentNote = becca.getNote(parentNoteId);
- // code note type can be inherited, otherwise text is default
+ // code note type can be inherited, otherwise "text" is the default
extraOptions.type = parentNote.type === 'code' ? 'code' : 'text';
extraOptions.mime = parentNote.type === 'code' ? parentNote.mime : 'text/html';
@@ -440,7 +440,7 @@ function BackendScriptApi(currentNote, apiParams) {
* Return randomly generated string of given length. This random string generation is NOT cryptographically secure.
*
* @method
- * @param {integer} length of the string
+ * @param {int} length of the string
* @returns {string} random string
*/
this.randomString = utils.randomString;
diff --git a/docs/frontend_api/FAttribute.html b/docs/frontend_api/FAttribute.html
index 1ef4a4eca..3c25e6bb4 100644
--- a/docs/frontend_api/FAttribute.html
+++ b/docs/frontend_api/FAttribute.html
@@ -416,7 +416,7 @@ and relation (representing named relationship between source and target note)position :integer
+position :int
@@ -427,7 +427,7 @@ and relation (representing named relationship between source and target note)
-
-integer
+int
diff --git a/docs/frontend_api/FBranch.html b/docs/frontend_api/FBranch.html
index ded0f398c..5cc4f01d2 100644
--- a/docs/frontend_api/FBranch.html
+++ b/docs/frontend_api/FBranch.html
@@ -420,7 +420,7 @@ parents.
-notePosition :integer
+notePosition :int
@@ -431,7 +431,7 @@ parents.
-
-integer
+int
@@ -1017,7 +1017,7 @@ parents.
- true if it's top level, meaning its parent is root note
+ true if it's top level, meaning its parent is the root note
diff --git a/docs/frontend_api/FNote.html b/docs/frontend_api/FNote.html
index 4002cd53c..dccb030b2 100644
--- a/docs/frontend_api/FNote.html
+++ b/docs/frontend_api/FNote.html
@@ -161,7 +161,7 @@
- Source:
@@ -264,7 +264,7 @@
- Source:
@@ -332,7 +332,7 @@
- Source:
@@ -400,7 +400,7 @@
- Source:
@@ -468,7 +468,7 @@
- Source:
@@ -536,7 +536,7 @@
- Source:
@@ -608,7 +608,7 @@
- Source:
@@ -676,7 +676,7 @@
- Source:
@@ -744,7 +744,7 @@
- Source:
@@ -812,7 +812,7 @@
- Source:
@@ -880,7 +880,7 @@
- Source:
@@ -948,7 +948,7 @@
- Source:
@@ -1020,7 +1020,7 @@
- Source:
@@ -1100,7 +1100,7 @@
- Source:
@@ -1206,7 +1206,7 @@
- Source:
@@ -1308,7 +1308,7 @@
- Source:
@@ -1482,7 +1482,7 @@
- Source:
@@ -1511,7 +1511,7 @@
- attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
+ attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
@@ -1660,7 +1660,7 @@
- Source:
@@ -1860,7 +1860,7 @@
- Source:
@@ -2039,7 +2039,7 @@
- Source:
@@ -2218,7 +2218,7 @@
- Source:
@@ -2388,7 +2388,7 @@
- Source:
@@ -2492,7 +2492,7 @@
- Source:
@@ -2596,7 +2596,7 @@
- Source:
@@ -2698,7 +2698,7 @@
- Source:
@@ -2800,7 +2800,7 @@
- Source:
@@ -2902,7 +2902,7 @@
- Source:
@@ -3053,7 +3053,7 @@
- Source:
@@ -3208,7 +3208,7 @@
- Source:
@@ -3375,7 +3375,7 @@
- Source:
@@ -3483,7 +3483,7 @@
- Source:
@@ -3585,7 +3585,7 @@
- Source:
@@ -3759,7 +3759,7 @@
- Source:
@@ -3788,7 +3788,7 @@
- attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
+ attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
@@ -3937,7 +3937,7 @@
- Source:
@@ -4137,7 +4137,7 @@
- Source:
@@ -4292,7 +4292,7 @@
- Source:
@@ -4447,7 +4447,7 @@
- Source:
@@ -4614,7 +4614,7 @@
- Source:
@@ -4769,7 +4769,7 @@
- Source:
@@ -4924,7 +4924,7 @@
- Source:
@@ -5091,7 +5091,7 @@
- Source:
@@ -5197,7 +5197,7 @@
- Source:
@@ -5299,7 +5299,7 @@
- Source:
@@ -5401,7 +5401,7 @@
- Source:
@@ -5503,7 +5503,7 @@
- Source:
@@ -5654,7 +5654,7 @@
- Source:
@@ -5809,7 +5809,7 @@
- Source:
@@ -5979,7 +5979,7 @@
- Source:
@@ -6130,7 +6130,7 @@
- Source:
@@ -6297,7 +6297,7 @@
- Source:
@@ -6403,7 +6403,7 @@
- Source:
@@ -6464,7 +6464,7 @@
- getSortedNotePathRecords(hoistedNoteIdopt) → {Array.<{isArchived: boolean, isInHoistedSubTree: boolean, notePath: Array.<string>, isHidden: boolean}>}
+ getSortedNotePathRecords(hoistedNoteIdopt) → {Array.<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, notePath: Array.<string>, isHidden: boolean}>}
@@ -6581,7 +6581,7 @@
- Source:
@@ -6617,7 +6617,7 @@
-
-Array.<{isArchived: boolean, isInHoistedSubTree: boolean, notePath: Array.<string>, isHidden: boolean}>
+Array.<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, notePath: Array.<string>, isHidden: boolean}>
@@ -6687,7 +6687,7 @@
- Source:
@@ -6793,7 +6793,7 @@
- Source:
@@ -6967,7 +6967,7 @@
- Source:
@@ -7073,7 +7073,7 @@
- Source:
@@ -7224,7 +7224,7 @@
- Source:
@@ -7402,7 +7402,7 @@
- Source:
@@ -7557,7 +7557,7 @@
- Source:
@@ -7712,7 +7712,7 @@
- Source:
@@ -7867,7 +7867,7 @@
- Source:
@@ -7975,7 +7975,7 @@
- Source:
@@ -8059,7 +8059,7 @@
- Source:
@@ -8153,7 +8153,7 @@
- Source:
@@ -8259,7 +8259,7 @@
- Source:
@@ -8365,7 +8365,7 @@
- Source:
@@ -8516,7 +8516,7 @@
- Source:
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html
index a61c1a6bb..69a31c5ef 100644
--- a/docs/frontend_api/FrontendScriptApi.html
+++ b/docs/frontend_api/FrontendScriptApi.html
@@ -2625,6 +2625,163 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
+ - Deprecated:
- - use api.formatSize()
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ formatted string
+
+
+
+
+
+ -
+ Type
+
+ -
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ formatSize(size) → {string}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ size
+
+
+
+
+
+int
+
+
+
+
+
+
+
+
+
+ in bytes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4675,7 +4832,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -5638,7 +5795,7 @@ otherwise (by e.g. createLink())
-integer
+int
diff --git a/docs/frontend_api/entities_fattribute.js.html b/docs/frontend_api/entities_fattribute.js.html
index 690ae0b49..a9b3c856a 100644
--- a/docs/frontend_api/entities_fattribute.js.html
+++ b/docs/frontend_api/entities_fattribute.js.html
@@ -50,7 +50,7 @@ class FAttribute {
this.name = row.name;
/** @type {string} */
this.value = row.value;
- /** @type {integer} */
+ /** @type {int} */
this.position = row.position;
/** @type {boolean} */
this.isInheritable = !!row.isInheritable;
diff --git a/docs/frontend_api/entities_fbranch.js.html b/docs/frontend_api/entities_fbranch.js.html
index 6a51a59a8..fbd5fcc73 100644
--- a/docs/frontend_api/entities_fbranch.js.html
+++ b/docs/frontend_api/entities_fbranch.js.html
@@ -47,7 +47,7 @@ class FBranch {
this.noteId = row.noteId;
/** @type {string} */
this.parentNoteId = row.parentNoteId;
- /** @type {integer} */
+ /** @type {int} */
this.notePosition = row.notePosition;
/** @type {string} */
this.prefix = row.prefix;
@@ -72,7 +72,7 @@ class FBranch {
return this.froca.getNote(this.parentNoteId);
}
- /** @returns {boolean} true if it's top level, meaning its parent is root note */
+ /** @returns {boolean} true if it's top level, meaning its parent is the root note */
isTopLevel() {
return this.parentNoteId === 'root';
}
diff --git a/docs/frontend_api/entities_fnote.js.html b/docs/frontend_api/entities_fnote.js.html
index db2d8c859..30cf97af1 100644
--- a/docs/frontend_api/entities_fnote.js.html
+++ b/docs/frontend_api/entities_fnote.js.html
@@ -32,7 +32,6 @@ import ws from "../services/ws.js";
import froca from "../services/froca.js";
import protectedSessionHolder from "../services/protected_session_holder.js";
import cssClassManager from "../services/css_class_manager.js";
-import FAttachment from "./fattachment.js";
const LABEL = 'label';
const RELATION = 'relation';
@@ -399,7 +398,7 @@ class FNote {
/**
* @param {string} [hoistedNoteId='root']
- * @return {Array<{isArchived: boolean, isInHoistedSubTree: boolean, notePath: Array<string>, isHidden: boolean}>}
+ * @return {Array<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, notePath: Array<string>, isHidden: boolean}>}
*/
getSortedNotePathRecords(hoistedNoteId = 'root') {
const isHoistedRoot = hoistedNoteId === 'root';
@@ -408,6 +407,7 @@ class FNote {
notePath: path,
isInHoistedSubTree: isHoistedRoot || path.includes(hoistedNoteId),
isArchived: path.some(noteId => froca.notes[noteId].isArchived),
+ isSearch: path.find(noteId => froca.notes[noteId].type === 'search'),
isHidden: path.includes('_hidden')
}));
@@ -418,6 +418,8 @@ class FNote {
return a.isArchived ? 1 : -1;
} else if (a.isHidden !== b.isHidden) {
return a.isHidden ? 1 : -1;
+ } else if (a.isSearch !== b.isSearch) {
+ return a.isSearch ? 1 : -1;
} else {
return a.notePath.length - b.notePath.length;
}
@@ -452,7 +454,9 @@ class FNote {
* @return boolean - true if there's no non-hidden path, note is not cloned to the visible tree
*/
isHiddenCompletely() {
- if (this.noteId === 'root') {
+ if (this.noteId === '_hidden') {
+ return true;
+ } else if (this.noteId === 'root') {
return false;
}
@@ -624,7 +628,7 @@ class FNote {
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
- * @returns {FAttribute} attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
+ * @returns {FAttribute} attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
*/
getOwnedAttribute(type, name) {
const attributes = this.getOwnedAttributes();
@@ -635,7 +639,7 @@ class FNote {
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
- * @returns {FAttribute} attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
+ * @returns {FAttribute} attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
*/
getAttribute(type, name) {
const attributes = this.getAttributes();
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html
index 76970d3e0..2d2ddfd29 100644
--- a/docs/frontend_api/services_frontend_script_api.js.html
+++ b/docs/frontend_api/services_frontend_script_api.js.html
@@ -107,7 +107,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
this.openTabWithNote = async (notePath, activate) => {
await ws.waitForMaxKnownEntityChangeId();
- await appContext.tabManager.openContextWithNote(notePath, { activate });
+ await appContext.tabManager.openTabWithNoteWithHoisting(notePath, { activate });
if (activate) {
await appContext.triggerEvent('focusAndSelectTitle');
@@ -506,7 +506,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* Return randomly generated string of given length. This random string generation is NOT cryptographically secure.
*
* @method
- * @param {integer} length of the string
+ * @param {int} length of the string
* @returns {string} random string
*/
this.randomString = utils.randomString;
@@ -516,7 +516,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* @param {int} size in bytes
* @return {string} formatted string
*/
- this.formatNoteSize = utils.formatNoteSize;
+ this.formatSize = utils.formatSize;
+
+ /**
+ * @method
+ * @param {int} size in bytes
+ * @return {string} formatted string
+ * @deprecated - use api.formatSize()
+ */
+ this.formatNoteSize = utils.formatSize;
this.logMessages = {};
this.logSpacedUpdates = {};