Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
typos
zadam192e399cb519
diff --git a/package-lock.json b/package-lock.jsonindex d7fec61595..cf17050996 100644--- a/package-lock.json+++ b/package-lock.json@@ -5,7 +5,6 @@"requires": true,"packages": {"": {- "name": "trilium","version": "0.60.4","hasInstallScript": true,"license": "AGPL-3.0-only",diff --git a/src/becca/becca_loader.js b/src/becca/becca_loader.jsindex a580266e90..e1518e8084 100644--- a/src/becca/becca_loader.js+++ b/src/becca/becca_loader.js@@ -105,7 +105,7 @@ eventService.subscribeBeccaLoader(eventService.ENTITY_CHANGED, ({entityName, en** @param entityName* @param entityRow - can be a becca entity (change comes from this trilium instance) or just a row (from sync).- * Should be therefore treated as a row.+ * It should be therefore treated as a row.*/function postProcessEntityUpdate(entityName, entityRow) {if (entityName === 'notes') {@@ -188,7 +188,7 @@ function branchUpdated(branchRow) {childNote.sortParents();// notes in the subtree can get new inherited attributes- // this is in theory needed upon branch creation, but there's no create event for sync changes+ // this is in theory needed upon branch creation, but there's no "create" event for sync changeschildNote.invalidateSubTree();}diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.jsindex a805012ee9..c9d437e6c4 100644--- a/src/becca/entities/bnote.js+++ b/src/becca/entities/bnote.js@@ -18,7 +18,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*/@@ -123,7 +123,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@@ -566,7 +566,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();@@ -688,7 +689,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 labelconst bestNotePathRecord = this.getSortedNotePathRecords()[0];@@ -1093,7 +1094,7 @@ 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 alwaysconst query = opts.includeContentLength@@ -1148,7 +1149,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) {@@ -1188,7 +1189,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@@ -1198,7 +1199,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')@@ -1338,7 +1339,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@@ -1397,7 +1398,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)@@ -1455,16 +1456,16 @@ 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 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).+ * are not satisfied (e.g., relation to parent doesn't exist).** @returns {BAttachment|null} - null if note is not eligible for conversion*/@@ -1549,7 +1550,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;}diff --git a/src/becca/entities/boption.js b/src/becca/entities/boption.jsindex 0188d9f7eb..1d876e6a2c 100644--- a/src/becca/entities/boption.js+++ b/src/becca/entities/boption.js@@ -4,7 +4,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/src/becca/similarity.js b/src/becca/similarity.jsindex 6f3983ca12..61bd02f450 100644--- a/src/becca/similarity.js+++ b/src/becca/similarity.js@@ -132,7 +132,7 @@ function buildRewardMap(note) {}}- // title is the top with weight 1 so smaller headings will have lower weight+ // the title is the top with weight 1 so smaller headings will have lower weight// technically H1 is not supported, but for the case it's present let's weigh it just as H2addHeadingsToRewardMap("h1", 0.9);@@ -260,7 +260,7 @@ async function findSimilarNotes(noteId) {let counter = 0;- // when the title is very long then weight of each individual word should be lowered+ // when the title is very long, then weight of each individual word should be lowered,// also pretty important in e.g. long URLs in label valuesconst lengthPenalization = 1 / Math.pow(text.length, 0.3);@@ -364,7 +364,7 @@ async function findSimilarNotes(noteId) {}/**- * We want to improve standing of notes which have been created in similar time to each other since+ * We want to improve the standing of notes which have been created in similar time to each other since* there's a good chance they are related.** But there's an exception - if they were created really close to each other (withing few seconds) then@@ -386,7 +386,7 @@ async function findSimilarNotes(noteId) {console.log("Adding reward for same day of creation");}- // smaller bonus when outside of the window but within same date+ // smaller bonus when outside of the window but within the same datescore += 0.5;}}diff --git a/src/public/app/components/app_context.js b/src/public/app/components/app_context.jsindex cea2c5d42d..2e06493dca 100644--- a/src/public/app/components/app_context.js+++ b/src/public/app/components/app_context.js@@ -107,7 +107,7 @@ class AppContext extends Component {}}- // this might hint at error but sometimes this is used by components which are at different places+ // this might hint at error, but sometimes this is used by components which are at different places// in the component tree to communicate with each otherconsole.debug(`Unhandled command ${name}, converting to event.`);diff --git a/src/public/app/components/tab_manager.js b/src/public/app/components/tab_manager.jsindex efbafc7403..770b2df4fb 100644--- a/src/public/app/components/tab_manager.js+++ b/src/public/app/components/tab_manager.js@@ -323,7 +323,7 @@ export default class TabManager extends Component {if (notePath) {await noteContext.setNote(notePath, {- // if activate is false then send normal noteSwitched event+ // if activate is false, then send normal noteSwitched eventtriggerSwitchEvent: !activate,viewScope: viewScope});@@ -378,7 +378,7 @@ export default class TabManager extends Component {* @returns {Promise<boolean>} true if note context has been removed, false otherwise*/async removeNoteContext(ntxId) {- // removing note context is async process which can take some time, if users presses CTRL-W quickly, two+ // removing note context is an async process which can take some time, if users presses CTRL-W quickly, two// close events could interleave which would then lead to attempting to activate already removed context.return await this.mutex.runExclusively(async () => {let noteContextToRemove;diff --git a/src/public/app/doc_notes/launchbar_note_launcher.html b/src/public/app/doc_notes/launchbar_note_launcher.htmlindex 403c6e2b4e..8d4d15b059 100644--- a/src/public/app/doc_notes/launchbar_note_launcher.html+++ b/src/public/app/doc_notes/launchbar_note_launcher.html@@ -6,4 +6,4 @@<li><code>keyboardShortcut</code> - optional, pressing the keyboard shortcut will open the note</li></ol>-<p>Launchbar displays the title / icon from the launcher which does not necessarily mirror those of the target note.</p>+<p>Launchbar displays the title / icon from the launcher, which does not necessarily mirror those of the target note.</p>diff --git a/src/public/app/entities/fbranch.js b/src/public/app/entities/fbranch.jsindex b1746c361c..b01030c48c 100644--- a/src/public/app/entities/fbranch.js+++ b/src/public/app/entities/fbranch.js@@ -44,7 +44,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/src/public/app/entities/fnote.js b/src/public/app/entities/fnote.jsindex b6f0e5ef20..0f5b493daf 100644--- a/src/public/app/entities/fnote.js+++ b/src/public/app/entities/fnote.js@@ -598,7 +598,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();@@ -609,7 +609,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/src/public/app/menus/context_menu.js b/src/public/app/menus/context_menu.jsindex c871278031..093803d5cb 100644--- a/src/public/app/menus/context_menu.js+++ b/src/public/app/menus/context_menu.js@@ -23,11 +23,11 @@ class ContextMenu {}positionMenu() {- // code below tries to detect when dropdown would overflow from page- // in such case we'll position it above click coordinates, so it will fit into client+ // the code below tries to detect when dropdown would overflow from page+ // in such case we'll position it above click coordinates, so it will fit into the client- const CONTEXT_MENU_PADDING = 5; // How many pixels to pad context menu from edge of screen- const CONTEXT_MENU_OFFSET = 0; // How many pixels to offset context menu by relative to cursor, see #3157+ const CONTEXT_MENU_PADDING = 5; // How many pixels to pad the context menu from edge of screen+ const CONTEXT_MENU_OFFSET = 0; // How many pixels to offset the context menu by relative to cursor, see #3157const clientHeight = document.documentElement.clientHeight;const clientWidth = document.documentElement.clientWidth;@@ -144,7 +144,7 @@ class ContextMenu {hide() {// this date checking comes from change in FF66 - https://github.com/zadam/trilium/issues/468- // "contextmenu" event also triggers "click" event which depending on the timing can close just opened context menu+ // "contextmenu" event also triggers "click" event which depending on the timing can close the just opened context menu// we might filter out right clicks, but then it's better if even right clicks close the context menuif (Date.now() - this.dateContextMenuOpenedMs > 300) {// seems like if we hide the menu immediately, some clicks can get propagated to the underlying componentdiff --git a/src/public/app/menus/tree_context_menu.js b/src/public/app/menus/tree_context_menu.jsindex aa457407f4..a83c45cb1b 100644--- a/src/public/app/menus/tree_context_menu.js+++ b/src/public/app/menus/tree_context_menu.js@@ -35,7 +35,7 @@ export default class TreeContextMenu {const isHoisted = note.noteId === appContext.tabManager.getActiveContext().hoistedNoteId;const parentNote = isNotRoot ? await froca.getNote(branch.parentNoteId) : null;- // some actions don't support multi-note, so they are disabled when notes are selected+ // some actions don't support multi-note, so they are disabled when notes are selected,// the only exception is when the only selected note is the one that was right-clicked, then// it's clear what the user meant to do.const selNodes = this.treeWidget.getSelectedNodes();diff --git a/src/public/app/services/froca_updater.js b/src/public/app/services/froca_updater.jsindex f8ea413d09..1feba52060 100644--- a/src/public/app/services/froca_updater.js+++ b/src/public/app/services/froca_updater.js@@ -59,7 +59,7 @@ async function processEntityChanges(entityChanges) {// froca is supposed to contain all notes currently being visible to the users in the tree / otherwise being processed// and their complete "ancestor relationship", so it's always possible to go up in the hierarchy towards the root.// To this we count: standard parent-child relationships and template/inherit relations (attribute inheritance follows them).- // Here we watch for changes which might violate this principle - e.g. introduction of a new "inherit" relation might+ // Here we watch for changes which might violate this principle - e.g., an introduction of a new "inherit" relation might// mean we need to load the target of the relation (and then perhaps transitively the whole note path of this target).const missingNoteIds = [];@@ -157,7 +157,7 @@ async function processBranchChange(loadResults, ec) {if (childNote && !childNote.isRoot() && !parentNote) {// a branch cannot exist without the parent// a note loaded into froca has to also contain all its ancestors,- // this problem happened e.g., in sharing where _share was hidden and thus not loaded+ // this problem happened, e.g., in sharing where _share was hidden and thus not loaded// sharing meant cloning into _share, which crashed because _share was not loadedparentNote = await froca.getNote(ec.entity.parentNoteId);}diff --git a/src/public/app/services/note_list_renderer.js b/src/public/app/services/note_list_renderer.jsindex 873b1f09d4..c619cada27 100644--- a/src/public/app/services/note_list_renderer.js+++ b/src/public/app/services/note_list_renderer.js@@ -185,7 +185,7 @@ class NoteListRenderer {this.viewType = parentNote.getLabelValue('viewType');if (!['list', 'grid'].includes(this.viewType)) {- // when not explicitly set decide based on note type+ // when not explicitly set, decide based on the note typethis.viewType = parentNote.type === 'search' ? 'list' : 'grid';}@@ -194,7 +194,7 @@ class NoteListRenderer {this.showNotePath = showNotePath;}- /** @returns {Set<string>} list of noteIds included (images, included notes) into a parent note and which+ /** @returns {Set<string>} list of noteIds included (images, included notes) in the parent note and which* don't have to be shown in the note list. */getIncludedNoteIds() {const includedLinks = this.parentNotediff --git a/src/public/app/services/protected_session.js b/src/public/app/services/protected_session.jsindex dd6692d43c..9fecf6aeb2 100644--- a/src/public/app/services/protected_session.js+++ b/src/public/app/services/protected_session.js@@ -28,7 +28,7 @@ function enterProtectedSession() {dfd.resolve(false);}else {- // using deferred instead of promise because it allows resolving from outside+ // using deferred instead of promise because it allows resolving from the outsideprotectedSessionDeferred = dfd;appContext.triggerCommand("showProtectedSessionPasswordDialog");diff --git a/src/public/app/services/shortcuts.js b/src/public/app/services/shortcuts.jsindex 083a5d0e57..9c99ef0d17 100644--- a/src/public/app/services/shortcuts.js+++ b/src/public/app/services/shortcuts.js@@ -17,7 +17,7 @@ function bindElShortcut($el, keyboardShortcut, handler, namespace = null) {if (namespace) {eventName += `.${namespace}`;- // if there's a namespace then we replace the existing event handler with the new one+ // if there's a namespace, then we replace the existing event handler with the new one$el.off(eventName);}diff --git a/src/public/app/services/spaced_update.js b/src/public/app/services/spaced_update.jsindex 1bd7b56496..bfac5f056b 100644--- a/src/public/app/services/spaced_update.js+++ b/src/public/app/services/spaced_update.js@@ -47,7 +47,7 @@ export default class SpacedUpdate {this.changed = false;}else {- // update not triggered but changes are still pending, so we need to schedule another check+ // update isn't triggered but changes are still pending, so we need to schedule another checkthis.scheduleUpdate();}}diff --git a/src/public/app/services/tree.js b/src/public/app/services/tree.jsindex 099f367f9d..858aa48042 100644--- a/src/public/app/services/tree.js+++ b/src/public/app/services/tree.js@@ -111,7 +111,7 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logErthrow 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+ // if there isn't actually any note path with hoisted note, then return the original resolved note pathreturn bestNotePath.includes(hoistedNoteId) ? bestNotePath : effectivePathSegments;}}diff --git a/src/public/app/services/utils.js b/src/public/app/services/utils.jsindex 4d913cd8b3..1fdd54bb62 100644--- a/src/public/app/services/utils.js+++ b/src/public/app/services/utils.js@@ -167,8 +167,8 @@ function isDesktop() {|| (!window.glob?.device && !/Mobi/.test(navigator.userAgent));}-// cookie code below works for simple use cases only - ASCII only-// not setting path so that cookies do not leak into other websites if multiplexed with reverse proxy+// the cookie code below works for simple use cases only - ASCII only+// not setting a path so that cookies do not leak into other websites if multiplexed with reverse proxyfunction setCookie(name, value) {const date = new Date(Date.now() + 10 * 365 * 24 * 60 * 60 * 1000);@@ -396,7 +396,7 @@ function areObjectsEqual () {return x.toString() === y.toString();}- // At last checking prototypes as good as we can+ // At last, checking prototypes as good as we canif (!(x instanceof Object && y instanceof Object)) {return false;}diff --git a/src/public/app/services/ws.js b/src/public/app/services/ws.jsindex 0da4106926..357a20fe3a 100644--- a/src/public/app/services/ws.js+++ b/src/public/app/services/ws.js@@ -86,7 +86,7 @@ async function executeFrontendUpdate(entityChanges) {}try {- // it's my turn so start it up+ // it's my turn, so start it upconsumeQueuePromise = consumeFrontendUpdateData();await consumeQueuePromise;@@ -175,7 +175,7 @@ async function consumeFrontendUpdateData() {logError(`Encountered error ${e.message}: ${e.stack}, reloading frontend.`);if (!glob.isDev && !options.is('debugModeEnabled')) {- // if there's an error in updating the frontend then the easy option to recover is to reload the frontend completely+ // if there's an error in updating the frontend, then the easy option to recover is to reload the frontend completelyutils.reloadFrontendApp();}diff --git a/src/public/app/widgets/attribute_widgets/attribute_editor.js b/src/public/app/widgets/attribute_widgets/attribute_editor.jsindex ac91617b99..8ded708f84 100644--- a/src/public/app/widgets/attribute_widgets/attribute_editor.js+++ b/src/public/app/widgets/attribute_widgets/attribute_editor.js@@ -310,7 +310,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {this.$saveAttributesButton.fadeOut();- // blink the attribute text to give visual hint that save has been executed+ // blink the attribute text to give a visual hint that save has been executedthis.$editor.css('opacity', 0);// revert back@@ -387,7 +387,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {parsedAttrs = attributeParser.lexAndParse(this.getPreprocessedData(), true);}catch (e) {- // the input is incorrect because user messed up with it and now needs to fix it manually+ // the input is incorrect because the user messed up with it and now needs to fix it manuallyreturn null;}diff --git a/src/public/app/widgets/buttons/launcher/note_launcher.js b/src/public/app/widgets/buttons/launcher/note_launcher.jsindex 001f94a033..d14f441bb9 100644--- a/src/public/app/widgets/buttons/launcher/note_launcher.js+++ b/src/public/app/widgets/buttons/launcher/note_launcher.js@@ -4,7 +4,7 @@ import appContext from "../../../components/app_context.js";import utils from "../../../services/utils.js";import linkContextMenuService from "../../../menus/link_context_menu.js";-// we're intentionally displaying the launcher title and icon instead of the target+// we're intentionally displaying the launcher title and icon instead of the target,// e.g. you want to make launchers to 2 mermaid diagrams which both have mermaid icon (ok),// but on the launchpad you want them distinguishable.// for titles, the note titles may follow a different scheme than maybe desirable on the launchpaddiff --git a/src/public/app/widgets/containers/launcher_container.js b/src/public/app/widgets/containers/launcher_container.jsindex a278dfe9c6..c5fb7d27d7 100644--- a/src/public/app/widgets/containers/launcher_container.js+++ b/src/public/app/widgets/containers/launcher_container.js@@ -67,7 +67,7 @@ export default class LauncherContainer extends FlexContainer {entitiesReloadedEvent({loadResults}) {if (loadResults.getBranchRows().find(branch => froca.getNoteFromCache(branch.parentNoteId)?.isLaunchBarConfig())) {- // changes in note placement requires reload of all launchers, all other changes are handled by individual+ // changes in note placement require reload of all launchers, all other changes are handled by individual// launchersthis.load();}diff --git a/src/public/app/widgets/containers/ribbon_container.js b/src/public/app/widgets/containers/ribbon_container.jsindex 31a0f6d1a8..a132a0aaf2 100644--- a/src/public/app/widgets/containers/ribbon_container.js+++ b/src/public/app/widgets/containers/ribbon_container.js@@ -341,7 +341,7 @@ export default class RibbonContainer extends NoteContextAwareWidget {entitiesReloadedEvent({loadResults}) {if (loadResults.isNoteReloaded(this.noteId) && this.lastNoteType !== this.note.type) {// note type influences the list of available ribbon tabs the most- // check for type is so that we don't update on each title rename+ // check for the type is so that we don't update on each title renamethis.lastNoteType = this.note.type;this.refresh();diff --git a/src/public/app/widgets/containers/right_pane_container.js b/src/public/app/widgets/containers/right_pane_container.jsindex 55cd457a3e..123f2416c3 100644--- a/src/public/app/widgets/containers/right_pane_container.js+++ b/src/public/app/widgets/containers/right_pane_container.js@@ -20,9 +20,9 @@ export default class RightPaneContainer extends FlexContainer {const promise = super.handleEventInChildren(name, data);if (['activeContextChanged', 'noteSwitchedAndActivated', 'noteSwitched'].includes(name)) {- // right pane is displayed only if some child widget is active+ // the right pane is displayed only if some child widget is active,// we'll reevaluate the visibility based on events which are probable to cause visibility change- // but these events needs to be finished and only then we check+ // but these events need to be finished and only then we checkif (promise) {promise.then(() => this.reEvaluateRightPaneVisibilityCommand());}diff --git a/src/public/app/widgets/containers/split_note_container.js b/src/public/app/widgets/containers/split_note_container.jsindex ed5af80224..d9e16cfccf 100644--- a/src/public/app/widgets/containers/split_note_container.js+++ b/src/public/app/widgets/containers/split_note_container.js@@ -157,7 +157,7 @@ export default class SplitNoteContainer extends FlexContainer {/*** widget.hasBeenAlreadyShown is intended for lazy loading of cached tabs - initial note switches of new tabs* are not executed, we're waiting for the first tab activation, and then we update the tab. After this initial- * activation further note switches are always propagated to the tabs.+ * activation, further note switches are always propagated to the tabs.*/handleEventInChildren(name, data) {if (['noteSwitched', 'noteSwitchedAndActivated'].includes(name)) {diff --git a/src/public/app/widgets/dialogs/bulk_actions.js b/src/public/app/widgets/dialogs/bulk_actions.jsindex 5c74ce62d5..747bb48bc6 100644--- a/src/public/app/widgets/dialogs/bulk_actions.js+++ b/src/public/app/widgets/dialogs/bulk_actions.js@@ -153,7 +153,7 @@ export default class BulkActionsDialog extends BasicWidget {&& row.noteId === '_bulkAction'&& row.isDeleted)) {- // this may be triggered from e.g. sync without open widget, then no need to refresh the widget+ // this may be triggered from e.g., sync without open widget, then no need to refresh the widgetif (this.selectedOrActiveNoteIds && this.$widget.is(":visible")) {this.refresh();}diff --git a/src/public/app/widgets/dialogs/jump_to_note.js b/src/public/app/widgets/dialogs/jump_to_note.jsindex 59c5159c45..385730260f 100644--- a/src/public/app/widgets/dialogs/jump_to_note.js+++ b/src/public/app/widgets/dialogs/jump_to_note.js@@ -84,7 +84,7 @@ export default class JumpToNoteDialog extends BasicWidget {}showInFullText(e) {- // stop from propagating upwards (dangerous especially with ctrl+enter executable javascript notes)+ // stop from propagating upwards (dangerous, especially with ctrl+enter executable javascript notes)e.preventDefault();e.stopPropagation();diff --git a/src/public/app/widgets/dialogs/revisions.js b/src/public/app/widgets/dialogs/revisions.jsindex 19b3aa9df6..1fa3eedc07 100644--- a/src/public/app/widgets/dialogs/revisions.js+++ b/src/public/app/widgets/dialogs/revisions.js@@ -246,8 +246,8 @@ export default class RevisionsDialog extends BasicWidget {this.$content.html($("<pre>").text(fullRevision.content));} else if (revisionItem.type === 'image') {this.$content.html($("<img>")- // reason why we put this inline as base64 is that we do not want to let user copy this- // as a URL to be used in a note. Instead, if they copy and paste it into a note, it will be an uploaded as a new note+ // the reason why we put this inline as base64 is that we do not want to let user copy this+ // as a URL to be used in a note. Instead, if they copy and paste it into a note, it will be uploaded as a new note.attr("src", `data:${fullRevision.mime};base64,${fullRevision.content}`).css("max-width", "100%").css("max-height", "100%"));diff --git a/src/public/app/widgets/note_list.js b/src/public/app/widgets/note_list.jsindex 5c8026163c..a8c292fcc1 100644--- a/src/public/app/widgets/note_list.js+++ b/src/public/app/widgets/note_list.js@@ -73,7 +73,7 @@ export default class NoteListWidget extends NoteContextAwareWidget {/*** We have this event so that we evaluate intersection only after note detail is loaded.- * If it's evaluated before note detail then it's clearly intersected (visible) although after note detail load+ * If it's evaluated before note detail, then it's clearly intersected (visible) although after note detail load* it is not intersected (visible) anymore.*/noteDetailRefreshedEvent({ntxId}) {diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.jsindex 5ffdbb0a29..dac3abae5a 100644--- a/src/public/app/widgets/note_tree.js+++ b/src/public/app/widgets/note_tree.js@@ -171,7 +171,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {this.triggerCommand('hoistNote', {noteId: node.data.noteId});});- // fancytree doesn't support middle click so this is a way to support it+ // fancytree doesn't support middle click, so this is a way to support itthis.$tree.on('mousedown', '.fancytree-title', e => {if (e.which === 2) {const node = $.ui.fancytree.getNode(e);@@ -353,7 +353,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {}},beforeActivate: (event, {node}) => {- // hidden subtree is hidden hackily, prevent activating it e.g. by keyboard+ // hidden subtree is hidden hackily, prevent activating it, e.g. by keyboardif (hoistedNoteService.getHoistedNoteId() === '_hidden') {// if we're hoisted in hidden subtree, we want to avoid crossing to "visible" tree,@@ -545,7 +545,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {const $unhoistButton = $('<span class="tree-item-button unhoist-button bx bx-door-open" title="Unhoist"></span>').on("click", cancelClickPropagation);- // unhoist button is prepended since compared to other buttons this is not just convenience+ // unhoist button is prepended since compared to other buttons, this is not just convenience// on the mobile interface - it's the only way to unhoist$span.prepend($unhoistButton);}@@ -812,7 +812,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {await this.batchUpdate(async () => {await node.load(true);- if (node.data.noteId !== hoistedNoteService.getHoistedNoteId()) { // hoisted note should be always expanded+ if (node.data.noteId !== hoistedNoteService.getHoistedNoteId()) { // hoisted note should always be expandedawait node.setExpanded(isExpanded, {noEvents: true, noAnimation: true});}});@@ -905,7 +905,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {await parentNode.setExpanded(true, {noAnimation: true});}- // although previous line should set the expanded status, it seems to happen asynchronously,+ // although the previous line should set the expanded status, it seems to happen asynchronously,// so we need to make sure it is set properly before calling updateNode which uses this flagconst branch = froca.getBranch(parentNode.data.branchId);branch.isExpanded = true;@@ -922,7 +922,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {if (!foundChildNode) {if (logErrors) {- // besides real errors this can be also caused by hiding of e.g. included images+ // besides real errors, this can be also caused by hiding of e.g. included images// these are real notes with real notePath, user can display them in a detail,// but they don't have a node in the tree@@ -1040,7 +1040,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {}/*- * We're collapsing notes after period of inactivity to "cleanup" the tree - users rarely+ * We're collapsing notes after a period of inactivity to "cleanup" the tree - users rarely* collapse the notes and the tree becomes unusuably large.* Some context: https://github.com/zadam/trilium/issues/1192*/@@ -1116,8 +1116,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {const note = froca.getNoteFromCache(ecAttr.noteId);if (note && note.getChildNoteIds().includes(ecAttr.value)) {- // there's new/deleted imageLink betwen note and its image child - which can show/hide- // the image (if there is a imageLink relation between parent and child+ // there's a new /deleted imageLink betwen note and its image child - which can show/hide+ // the image (if there is an imageLink relation between parent and child,// then it is assumed to be "contained" in the note and thus does not have to be displayed in the tree)noteIdsToReload.add(ecAttr.noteId);}@@ -1213,7 +1213,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {}});- // for some reason node update cannot be in the batchUpdate() block (node is not re-rendered)+ // for some reason, node update cannot be in the batchUpdate() block (node is not re-rendered)for (const noteId of noteIdsToUpdate) {for (const node of this.getNodesByNoteId(noteId)) {await this.updateNode(node);@@ -1239,7 +1239,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {// so we switch to the alternative of trying to find it by noteIdconst notesById = this.getNodesByNoteId(activeNoteId);- // if there are multiple clones then we'd rather not activate any one+ // if there are multiple clones, then we'd rather not activate anyonenode = notesById.length === 1 ? notesById[0] : null;}@@ -1252,7 +1252,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {await node.setActive(true, {noEvents: true, noFocus: !activeNodeFocused});}else {- // this is used when original note has been deleted, and we want to move the focus to the note above/below+ // this is used when the original note has been deleted, and we want to move the focus to the note above/belownode = await this.expandToNote(nextNotePath, false);if (node) {diff --git a/src/public/app/widgets/note_type.js b/src/public/app/widgets/note_type.jsindex ab39234e97..fe60318ae4 100644--- a/src/public/app/widgets/note_type.js+++ b/src/public/app/widgets/note_type.js@@ -64,7 +64,7 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {this.$noteTypeButton.dropdown('hide');}- /** actual body is rendered lazily on note-type button click */+ /** the actual body is rendered lazily on note-type button click */async renderDropdown() {this.$noteTypeDropdown.empty();diff --git a/src/public/app/widgets/ribbon_widgets/promoted_attributes.js b/src/public/app/widgets/ribbon_widgets/promoted_attributes.jsindex 8293875ee1..4bf162ebf8 100644--- a/src/public/app/widgets/ribbon_widgets/promoted_attributes.js+++ b/src/public/app/widgets/ribbon_widgets/promoted_attributes.js@@ -107,7 +107,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget {}}- // we replace the whole content in one step so there can't be any race conditions+ // we replace the whole content in one step, so there can't be any race conditions// (previously we saw promoted attributes doubling)this.$container.empty().append(...$cells);this.toggleInt(true);diff --git a/src/public/app/widgets/search_options/search_string.js b/src/public/app/widgets/search_options/search_string.jsindex 89bc3304e6..38106adaa3 100644--- a/src/public/app/widgets/search_options/search_string.js+++ b/src/public/app/widgets/search_options/search_string.js@@ -47,8 +47,8 @@ export default class SearchString extends AbstractSearchOption {shortcutService.bindElShortcut(this.$searchString, 'return', async () => {// this also in effect disallows new lines in query string.- // on one hand this makes sense since search string is a label- // on the other hand it could be nice for structuring long search string. It's probably a niche case though.+ // on one hand, this makes sense since search string is a label+ // on the other hand, it could be nice for structuring long search string. It's probably a niche case though.await this.spacedUpdate.updateNowIfNecessary();this.triggerCommand('refreshResults');diff --git a/src/public/app/widgets/tab_row.js b/src/public/app/widgets/tab_row.jsindex 3308d2449e..791be35079 100644--- a/src/public/app/widgets/tab_row.js+++ b/src/public/app/widgets/tab_row.js@@ -336,7 +336,7 @@ export default class TabRowWidget extends BasicWidget {position += width + MARGIN_WIDTH;});- position -= MARGIN_WIDTH; // last margin should not be applied+ position -= MARGIN_WIDTH; // the last margin should not be appliedconst newTabPosition = position;const fillerPosition = position + 32;@@ -542,7 +542,7 @@ export default class TabRowWidget extends BasicWidget {});draggabilly.on('dragMove', (event, pointer, moveVector) => {- // Current index be computed within the event since it can change during the dragMove+ // The current index be computed within the event since it can change during the dragMoveconst tabEls = this.tabEls;const currentIndex = tabEls.indexOf(tabEl);diff --git a/src/public/app/widgets/toc.js b/src/public/app/widgets/toc.jsindex ac718b9fde..2fac0c1591 100644--- a/src/public/app/widgets/toc.js+++ b/src/public/app/widgets/toc.js@@ -2,14 +2,14 @@* Table of contents widget* (c) Antonio Tejada 2022*- * By design there's no support for nonsensical or malformed constructs:+ * By design, there's no support for nonsensical or malformed constructs:* - headings inside elements (e.g. Trilium allows headings inside tables, but* not inside lists)* - nested headings when using raw HTML <H2><H3></H3></H2>* - malformed headings when using raw HTML <H2></H3></H2><H3>* - etc.*- * In those cases the generated TOC may be incorrect or the navigation may lead+ * In those cases, the generated TOC may be incorrect, or the navigation may lead* to the wrong heading (although what "right" means in those cases is not* clear), but it won't crash.*/diff --git a/src/public/app/widgets/type_widgets/editable_code.js b/src/public/app/widgets/type_widgets/editable_code.jsindex 49e4e604a1..9674e7b25d 100644--- a/src/public/app/widgets/type_widgets/editable_code.js+++ b/src/public/app/widgets/type_widgets/editable_code.js@@ -72,7 +72,7 @@ export default class EditableCodeTypeWidget extends TypeWidget {const blob = await this.note.getBlob();await this.spacedUpdate.allowUpdateWithoutChange(() => {- // CodeMirror breaks pretty badly on null, so even though it shouldn't happen (guarded by consistency check)+ // CodeMirror breaks pretty badly on null, so even though it shouldn't happen (guarded by a consistency check)// we provide fallbackthis.codeEditor.setValue(blob.content || "");this.codeEditor.clearHistory();diff --git a/src/public/app/widgets/type_widgets/editable_text.js b/src/public/app/widgets/type_widgets/editable_text.jsindex 4eb3d7483a..0b013fd277 100644--- a/src/public/app/widgets/type_widgets/editable_text.js+++ b/src/public/app/widgets/type_widgets/editable_text.js@@ -192,7 +192,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {getData() {const content = this.watchdog.editor.getData();- // if content is only tags/whitespace (typically <p> </p>), then just make it empty+ // if content is only tags/whitespace (typically <p> </p>), then just make it empty,// this is important when setting a new note to codereturn {content: utils.isHtmlEmpty(content) ? '' : contentdiff --git a/src/public/app/widgets/type_widgets/relation_map.js b/src/public/app/widgets/type_widgets/relation_map.jsindex 6badd57c05..abce1c4c31 100644--- a/src/public/app/widgets/type_widgets/relation_map.js+++ b/src/public/app/widgets/type_widgets/relation_map.js@@ -91,7 +91,7 @@ export default class RelationMapTypeWidget extends TypeWidget {if (this.clipboard) {let {x, y} = this.getMousePosition(event);- // modifying position so that cursor is on the top-center of the box+ // modifying position so that the cursor is on the top-center of the boxx -= 80;y -= 15;@@ -186,8 +186,8 @@ export default class RelationMapTypeWidget extends TypeWidget {async loadMapData() {this.mapData = {notes: [],- // it is important to have this exact value here so that initial transform is same as this- // which will guarantee note won't be saved on first conversion to relation map note type+ // it is important to have this exact value here so that initial transform is the same as this+ // which will guarantee note won't be saved on first conversion to the relation map note type// this keeps the principle that note type change doesn't destroy note content unless user// does some actual changetransform: {@@ -231,7 +231,7 @@ export default class RelationMapTypeWidget extends TypeWidget {// this is done at this point (after async operations) to reduce flicker to the minimumthis.jsPlumbInstance.deleteEveryEndpoint();- // without this we still end up with note boxes remaining in the canvas+ // without this, we still end up with note boxes remaining in the canvasthis.$relationMapContainer.empty();}@@ -305,7 +305,7 @@ export default class RelationMapTypeWidget extends TypeWidget {minZoom: 0.3,smoothScroll: false,filterKey: function(e, dx, dy, dz) {- // if ALT is pressed then panzoom should bubble the event up+ // if ALT is pressed, then panzoom should bubble the event up// this is to preserve ALT-LEFT, ALT-RIGHT navigation workingreturn e.altKey;}diff --git a/src/routes/api/branches.js b/src/routes/api/branches.jsindex 83666f0081..8999ed7f64 100644--- a/src/routes/api/branches.js+++ b/src/routes/api/branches.js@@ -43,7 +43,7 @@ function moveBranchBeforeNote(req) {const originalBeforeNotePosition = beforeBranch.notePosition;- // we don't change utcDateModified so other changes are prioritized in case of conflict+ // we don't change utcDateModified, so other changes are prioritized in case of conflict// also we would have to sync all those modified branches otherwise hash checks would failsql.execute("UPDATE branches SET notePosition = notePosition + 10 WHERE parentNoteId = ? AND notePosition >= ? AND isDeleted = 0",@@ -93,7 +93,7 @@ function moveBranchAfterNote(req) {const originalAfterNotePosition = afterNote.notePosition;- // we don't change utcDateModified so other changes are prioritized in case of conflict+ // we don't change utcDateModified, so other changes are prioritized in case of conflict// also we would have to sync all those modified branches otherwise hash checks would failsql.execute("UPDATE branches SET notePosition = notePosition + 10 WHERE parentNoteId = ? AND notePosition > ? AND isDeleted = 0",[afterNote.parentNoteId, originalAfterNotePosition]);diff --git a/src/routes/api/import.js b/src/routes/api/import.jsindex 0e37fc5062..eccc745f03 100644--- a/src/routes/api/import.js+++ b/src/routes/api/import.js@@ -97,7 +97,7 @@ async function importAttachmentsToNote(req) {const parentNote = becca.getNoteOrThrow(parentNoteId);const taskContext = TaskContext.getInstance(taskId, 'importAttachment', options);- // unlike in note import we let the events run, because a huge number of attachments is not likely+ // unlike in note import, we let the events run, because a huge number of attachments is not likelytry {await singleImportService.importAttachment(taskContext, file, parentNote);diff --git a/src/routes/api/note_map.js b/src/routes/api/note_map.jsindex 4faa5b3a8e..4816be9c13 100644--- a/src/routes/api/note_map.js+++ b/src/routes/api/note_map.js@@ -92,13 +92,13 @@ function getNeighbors(note, depth) {function getLinkMap(req) {const mapRootNote = becca.getNote(req.params.noteId);- // if the map root itself has exclude attribute (journal typically) then there wouldn't be anything to display, so- // we'll just ignore it+ // if the map root itself has "excludeFromNoteMap" attribute (journal typically) then there wouldn't be anything+ // to display, so we'll just ignore itconst ignoreExcludeFromNoteMap = mapRootNote.isLabelTruthy('excludeFromNoteMap');let unfilteredNotes;if (mapRootNote.type === 'search') {- // for search notes we want to consider the direct search results only without the descendants+ // for search notes, we want to consider the direct search results only without the descendantsunfilteredNotes = mapRootNote.getSearchResultNotes();} else {unfilteredNotes = mapRootNote.getSubtree({@@ -167,8 +167,8 @@ function getLinkMap(req) {function getTreeMap(req) {const mapRootNote = becca.getNote(req.params.noteId);- // if the map root itself has ignore (journal typically) then there wouldn't be anything to display, so- // we'll just ignore it+ // if the map root itself has "excludeFromNoteMap" (journal typically) then there wouldn't be anything to display,+ // so we'll just ignore itconst ignoreExcludeFromNoteMap = mapRootNote.isLabelTruthy('excludeFromNoteMap');const subtree = mapRootNote.getSubtree({includeArchived: false,diff --git a/src/routes/api/options.js b/src/routes/api/options.jsindex 5601272ae5..44db511154 100644--- a/src/routes/api/options.js+++ b/src/routes/api/options.js@@ -5,7 +5,7 @@ const log = require('../../services/log');const searchService = require('../../services/search/services/search');const ValidationError = require("../../errors/validation_error");-// options allowed to be updated directly in options dialog+// options allowed to be updated directly in the Options dialogconst ALLOWED_OPTIONS = new Set(['eraseEntitiesAfterTimeInSeconds','protectedSessionTimeout',diff --git a/src/routes/api/sync.js b/src/routes/api/sync.jsindex 274dc51991..3dd66e27bc 100644--- a/src/routes/api/sync.js+++ b/src/routes/api/sync.js@@ -228,7 +228,7 @@ setInterval(() => {}, 60 * 1000);function syncFinished() {- // after first sync finishes, the application is ready to be used+ // after the first sync finishes, the application is ready to be used// this is meaningless but at the same time harmless (idempotent) for further syncssqlInit.setDbAsInitialized();}diff --git a/src/routes/routes.js b/src/routes/routes.jsindex 0192a07cc6..120c23dbd9 100644--- a/src/routes/routes.js+++ b/src/routes/routes.js@@ -231,7 +231,7 @@ function register(app) {// docker health checkroute(GET, '/api/health-check', [], () => ({"status": "ok"}), apiResultHandler);- // group of services below are meant to be executed from outside+ // group of the services below are meant to be executed from the outsideroute(GET, '/api/setup/status', [], setupApiRoute.getStatus, apiResultHandler);route(PST, '/api/setup/new-document', [auth.checkAppNotInitialized], setupApiRoute.setupNewDocument, apiResultHandler, false);route(PST, '/api/setup/sync-from-server', [auth.checkAppNotInitialized], setupApiRoute.setupSyncFromServer, apiResultHandler, false);@@ -380,7 +380,7 @@ function apiResultHandler(req, res, result) {result = convertEntitiesToPojo(result);- // if it's an array and first element is integer then we consider this to be [statusCode, response] format+ // if it's an array and the first element is integer, then we consider this to be [statusCode, response] formatif (Array.isArray(result) && result.length > 0 && Number.isInteger(result[0])) {const [statusCode, response] = result;diff --git a/src/services/attributes.js b/src/services/attributes.jsindex c0be6adf08..7807a93fca 100644--- a/src/services/attributes.js+++ b/src/services/attributes.js@@ -21,7 +21,7 @@ function getNotesWithLabel(name, value = undefined) {// TODO: should be in search service/** @returns {BNote|null} */function getNoteWithLabel(name, value = undefined) {- // optimized version (~20 times faster) without using normal search, useful for e.g. finding date notes+ // optimized version (~20 times faster) without using normal search, useful for e.g., finding date notesconst attrs = becca.findAttributes('label', name);if (value === undefined) {diff --git a/src/services/auth.js b/src/services/auth.jsindex 09d3707d22..951e0710ea 100644--- a/src/services/auth.js+++ b/src/services/auth.js@@ -23,7 +23,7 @@ function checkAuth(req, res, next) {}// for electron things which need network stuff-// currently we're doing that for file upload because handling form data seems to be difficult+// currently, we're doing that for file upload because handling form data seems to be difficultfunction checkApiAuthOrElectron(req, res, next) {if (!req.session.loggedIn && !utils.isElectron() && !noAuthentication) {reject(req, res, "Logged in session not found");diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.jsindex f69a403303..ed0e0902c5 100644--- a/src/services/backend_script_api.js+++ b/src/services/backend_script_api.js@@ -142,7 +142,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;@@ -164,7 +164,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;@@ -244,7 +244,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 defaultextraOptions.type = parentNote.type === 'code' ? 'code' : 'text';extraOptions.mime = parentNote.type === 'code' ? parentNote.mime : 'text/html';diff --git a/src/services/cloning.js b/src/services/cloning.jsindex 87cab8122b..cdf7b36534 100644--- a/src/services/cloning.js+++ b/src/services/cloning.js@@ -156,7 +156,7 @@ function cloneNoteAfter(noteId, afterBranchId) {return validationResult;}- // we don't change utcDateModified so other changes are prioritized in case of conflict+ // we don't change utcDateModified, so other changes are prioritized in case of conflict// also we would have to sync all those modified branches otherwise hash checks would failsql.execute("UPDATE branches SET notePosition = notePosition + 10 WHERE parentNoteId = ? AND notePosition > ? AND isDeleted = 0",[afterNote.parentNoteId, afterNote.notePosition]);diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.jsindex 8188f601dd..a085bb9156 100644--- a/src/services/consistency_checks.js+++ b/src/services/consistency_checks.js@@ -810,7 +810,7 @@ function getBlankContent(isProtected, type, mime) {return '{}';}- return ''; // empty string might be wrong choice for some note types, but it's the best guess+ return ''; // empty string might be a wrong choice for some note types, but it's the best guess}function logFix(message) {diff --git a/src/services/export/zip.js b/src/services/export/zip.jsindex b543d3b72a..704b94b6fe 100644--- a/src/services/export/zip.js+++ b/src/services/export/zip.js@@ -108,7 +108,7 @@ async function exportToZip(taskContext, branch, format, res, setHeaders = true)}}- // if the note is already named with extension (e.g. "jquery"), then it's silly to append exact same extension again+ // if the note is already named with extension (e.g. "jquery"), then it's silly to append the exact same extension againif (newExtension && existingExtension !== `.${newExtension.toLowerCase()}`) {fileName += `.${newExtension}`;}diff --git a/src/services/import/opml.js b/src/services/import/opml.jsindex c74c444ef7..2b99dbd85a 100644--- a/src/services/import/opml.js+++ b/src/services/import/opml.js@@ -76,7 +76,7 @@ async function importOpml(taskContext, fileBuffer, parentNote) {for (const outline of outlines) {const note = importOutline(outline, parentNote.noteId);- // first created note will be activated after import+ // the first created note will be activated after importreturnNote = returnNote || note;}diff --git a/src/services/import/zip.js b/src/services/import/zip.jsindex 802b4694f7..b0af9b678a 100644--- a/src/services/import/zip.js+++ b/src/services/import/zip.js@@ -145,7 +145,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) {} else if (parentPath in createdPaths) {parentNoteId = createdPaths[parentPath];} else {- // ZIP allows creating out of order records - i.e., file in a directory can appear in the ZIP stream before actual directory+ // ZIP allows creating out of order records - i.e., file in a directory can appear in the ZIP stream before the actual directoryparentNoteId = saveDirectory(parentPath);}}diff --git a/src/services/notes.js b/src/services/notes.jsindex b02d619ad5..ebc7c0f1e1 100644--- a/src/services/notes.js+++ b/src/services/notes.js@@ -69,7 +69,7 @@ function copyChildAttributes(parentNote, childNote) {if (hasAlreadyTemplate && attr.type === 'relation' && name === 'template') {// if the note already has a template, it means the template was chosen by the user explicitly- // in the menu. In that case we should override the default templates defined in the child: attrs+ // in the menu. In that case, we should override the default templates defined in the child: attrscontinue;}@@ -105,8 +105,8 @@ function getNewNoteTitle(parentNote) {}}- // this isn't in theory a good place to sanitize title, but this will catch a lot of XSS attempts- // title is supposed to contain text only (not HTML) and be printed text only, but given the number of usages+ // this isn't in theory a good place to sanitize title, but this will catch a lot of XSS attempts.+ // title is supposed to contain text only (not HTML) and be printed text only, but given the number of usages,// it's difficult to guarantee correct handling in all casestitle = htmlSanitizer.sanitize(title);@@ -147,12 +147,12 @@ function getAndValidateParent(params) {* - {*} content* - {string} type - text, code, file, image, search, book, relationMap, canvas, render*- * Following are optional (have defaults)+ * The following are optional (have defaults)* - {string} mime - value is derived from default mimes for type* - {boolean} isProtected - default is false* - {boolean} isExpanded - default is false* - {string} prefix - default is empty string- * - {int} notePosition - default is last existing notePosition in a parent + 10+ * - {int} notePosition - default is the last existing notePosition in a parent + 10** @param params* @returns {{note: BNote, branch: BBranch}}@@ -226,7 +226,7 @@ function createNewNote(params) {eventService.emit(eventService.ENTITY_CREATED, { entityName: 'notes', entity: note });eventService.emit(eventService.ENTITY_CHANGED, { entityName: 'notes', entity: note });triggerNoteTitleChanged(note);- // blobs doesn't use "created" event+ // blobs entity doesn't use "created" eventeventService.emit(eventService.ENTITY_CHANGED, { entityName: 'blobs', entity: note });eventService.emit(eventService.ENTITY_CREATED, { entityName: 'branches', entity: branch });eventService.emit(eventService.ENTITY_CHANGED, { entityName: 'branches', entity: branch });@@ -245,7 +245,7 @@ function createNewNoteWithTarget(target, targetBranchId, params) {if (!params.type) {const parentNote = becca.notes[params.parentNoteId];- // code note type can be inherited, otherwise text is default+ // code note type can be inherited, otherwise "text" is the defaultparams.type = parentNote.type === 'code' ? 'code' : 'text';params.mime = parentNote.type === 'code' ? parentNote.mime : 'text/html';}@@ -366,7 +366,7 @@ function checkImageAttachments(note, content) {const unknownAttachments = becca.getAttachments(unknownAttachmentIds);for (const unknownAttachment of unknownAttachments) {- // the attachment belongs to a different note (was copy pasted). Attachments can be linked only from the note+ // the attachment belongs to a different note (was copy-pasted). Attachments can be linked only from the note// which owns it, so either find an existing attachment having the same content or make a copy.let localAttachment = note.getAttachments().find(att => att.role === unknownAttachment.role && att.blobId === unknownAttachment.blobId);@@ -412,7 +412,7 @@ function findImageLinks(content, foundLinks) {});}- // removing absolute references to server to keep it working between instances+ // removing absolute references to server to keep it working between instances,// we also omit / at the beginning to keep the paths relativereturn content.replace(/src="[^"]*\/api\/images\//g, 'src="api/images/');}@@ -557,10 +557,10 @@ function downloadImages(noteId, content) {setTimeout(() => {// the normal expected flow of the offline image saving is that users will paste the image(s)// which will get asynchronously downloaded, during that time they keep editing the note- // once the download is finished, the image note representing downloaded image will be used+ // once the download is finished, the image note representing the downloaded image will be used// to replace the IMG link.- // However, there's another flow where user pastes the image and leaves the note before the images- // are downloaded and the IMG references are not updated. For this occassion we have this code+ // However, there's another flow where the user pastes the image and leaves the note before the images+ // are downloaded and the IMG references are not updated. For this occasion we have this code// which upon the download of all the images will update the note if the links have not been fixed beforesql.transactional(() => {@@ -972,7 +972,7 @@ function eraseUnusedAttachmentsNow() {eraseScheduledAttachments(0);}-// do a replace in str - all keys should be replaced by the corresponding values+// all keys should be replaced by the corresponding valuesfunction replaceByMap(str, mapObj) {const re = new RegExp(Object.keys(mapObj).join("|"),"g");@@ -1076,7 +1076,7 @@ function duplicateSubtreeInner(origNote, origBranch, newParentNoteId, noteIdMappconst existingNote = becca.notes[newNoteId];if (existingNote && existingNote.title !== undefined) { // checking that it's not just note's skeleton created because of Branch above- // note has multiple clones and was already created from another placement in the tree+ // note has multiple clones and was already created from another placement in the tree,// so a branch is all we need for this clonereturn {note: existingNote,diff --git a/src/services/request.js b/src/services/request.jsindex f54e9c5031..b67b807f34 100644--- a/src/services/request.js+++ b/src/services/request.js@@ -123,7 +123,7 @@ function getImage(imageUrl) {host: parsedTargetUrl.hostname,port: parsedTargetUrl.port,path: parsedTargetUrl.path,- timeout: opts.timeout, // works only for node client+ timeout: opts.timeout, // works only for the node clientheaders: {},agent: proxyAgent});@@ -170,7 +170,7 @@ function getProxyAgent(opts) {}function getClient(opts) {- // it's not clear how to explicitly configure proxy (as opposed to system proxy)+ // it's not clear how to explicitly configure proxy (as opposed to system proxy),// so in that case, we always use node's modulesif (utils.isElectron() && !opts.proxy) {return require('electron').net;diff --git a/src/services/resource_dir.js b/src/services/resource_dir.jsindex 862887474b..4f3710e181 100644--- a/src/services/resource_dir.js+++ b/src/services/resource_dir.js@@ -4,7 +4,7 @@ const fs = require('fs');const RESOURCE_DIR = path.resolve(__dirname, "../..");-// where "trilium" executable is+// where the "trilium" executable isconst ELECTRON_APP_ROOT_DIR = path.resolve(RESOURCE_DIR, "../..");const DB_INIT_DIR = path.resolve(RESOURCE_DIR, "db");diff --git a/src/services/script.js b/src/services/script.jsindex 2f085db339..34eb26502e 100644--- a/src/services/script.js+++ b/src/services/script.js@@ -35,7 +35,7 @@ function executeBundle(bundle, apiParams = {}) {cls.set('componentId', 'script');cls.set('bundleNoteId', bundle.note.noteId);- // last \r\n is necessary if script contains line comment on its last line+ // last \r\n is necessary if the script contains line comment on its last lineconst script = `function() {\r${bundle.script}\r}`;diff --git a/src/services/search/expressions/order_by_and_limit.js b/src/services/search/expressions/order_by_and_limit.jsindex c36e50388f..8e8352f6d7 100644--- a/src/services/search/expressions/order_by_and_limit.js+++ b/src/services/search/expressions/order_by_and_limit.js@@ -47,7 +47,7 @@ class OrderByAndLimitExp extends Expression {return larger;}- // if both are numbers then parse them for numerical comparison+ // if both are numbers, then parse them for numerical comparisonif (this.isNumber(valA) && this.isNumber(valB)) {valA = parseFloat(valA);valB = parseFloat(valB);diff --git a/src/services/search/expressions/property_comparison.js b/src/services/search/expressions/property_comparison.jsindex a53bd5eca7..c506cf9955 100644--- a/src/services/search/expressions/property_comparison.js+++ b/src/services/search/expressions/property_comparison.js@@ -5,8 +5,8 @@ const NoteSet = require('../note_set');const buildComparator = require("../services/build_comparator");/**- * Search string is lower cased for case-insensitive comparison. But when retrieving properties- * we need case-sensitive form, so we have this translation object.+ * Search string is lower cased for case-insensitive comparison. But when retrieving properties,+ * we need the case-sensitive form, so we have this translation object.*/const PROP_MAPPING = {"noteid": "noteId",diff --git a/src/services/search/search_context.js b/src/services/search/search_context.jsindex 95b8b8c57f..8db266e33c 100644--- a/src/services/search/search_context.js+++ b/src/services/search/search_context.js@@ -33,7 +33,7 @@ class SearchContext {}addError(error) {- // we record only the first error, subsequent ones are usually consequence of the first+ // we record only the first error, subsequent ones are usually a consequence of the firstif (!this.error) {this.error = error;}diff --git a/src/services/search/value_extractor.js b/src/services/search/value_extractor.jsindex 28ca842ec5..633666d298 100644--- a/src/services/search/value_extractor.js+++ b/src/services/search/value_extractor.js@@ -1,7 +1,7 @@"use strict";/**- * Search string is lower cased for case-insensitive comparison. But when retrieving properties+ * Search string is lower cased for case-insensitive comparison. But when retrieving properties,* we need a case-sensitive form, so we have this translation object.*/const PROP_MAPPING = {diff --git a/src/services/setup.js b/src/services/setup.jsindex 6119c1bc30..02a3ef32eb 100644--- a/src/services/setup.js+++ b/src/services/setup.js@@ -37,7 +37,7 @@ async function sendSeedToSyncServer() {syncVersion: appInfo.syncVersion});- // this is completely new sync, need to reset counters. If this would not be new sync,+ // this is a completely new sync, need to reset counters. If this was not a new sync,// the previous request would have failed.optionService.setOption('lastSyncedPush', 0);optionService.setOption('lastSyncedPull', 0);@@ -66,7 +66,7 @@ async function setupSyncFromSyncServer(syncServerHost, syncProxy, password) {try {log.info("Getting document options FROM sync server.");- // response is expected to contain documentId and documentSecret options+ // the response is expected to contain documentId and documentSecret optionsconst resp = await request.exec({method: 'get',url: `${syncServerHost}/api/setup/sync-seed`,diff --git a/src/services/spaced_update.js b/src/services/spaced_update.jsindex 1257c4e2c7..9518df908b 100644--- a/src/services/spaced_update.js+++ b/src/services/spaced_update.js@@ -47,7 +47,7 @@ class SpacedUpdate {this.changed = false;}else {- // update not triggered but changes are still pending, so we need to schedule another check+ // update isn't triggered but changes are still pending, so we need to schedule another checkthis.scheduleUpdate();}}diff --git a/src/services/sql_init.js b/src/services/sql_init.jsindex d32f98698e..47e6b8733d 100644--- a/src/services/sql_init.js+++ b/src/services/sql_init.js@@ -171,7 +171,7 @@ dbReady.then(() => {// kickoff first backup soon after start upsetTimeout(() => require('./backup').regularBackup(), 5 * 60 * 1000);- // optimize is usually inexpensive no-op so running it semi-frequently is not a big deal+ // optimize is usually inexpensive no-op, so running it semi-frequently is not a big dealsetTimeout(() => optimize(), 60 * 60 * 1000);setInterval(() => optimize(), 10 * 60 * 60 * 1000);diff --git a/src/services/sync.js b/src/services/sync.jsindex 8cbfaa7df0..24b2024422 100644--- a/src/services/sync.js+++ b/src/services/sync.js@@ -203,7 +203,7 @@ async function pushChanges(syncContext) {});if (filteredEntityChanges.length === 0) {- // there still might be more sync changes (because of batch limit), just all from current batch+ // there still might be more sync changes (because of batch limit), just all the current batch// has been filtered outsetLastSyncedPush(lastSyncedPush);@@ -255,7 +255,7 @@ async function checkContentHash(syncContext) {const failedChecks = contentHashService.checkContentHashes(resp.entityHashes);if (failedChecks.length > 0) {- // before requeuing sectors make sure the entity changes are correct+ // before requeuing sectors, make sure the entity changes are correctconst consistencyChecks = require("./consistency_checks");consistencyChecks.runEntityChangesChecks();diff --git a/src/services/sync_options.js b/src/services/sync_options.jsindex af3c4e25e0..a059be9735 100644--- a/src/services/sync_options.js+++ b/src/services/sync_options.js@@ -21,7 +21,7 @@ module.exports = {isSyncSetup: () => {const syncServerHost = get('syncServerHost');- // special value "disabled" is here to support use case where document is configured with sync server,+ // special value "disabled" is here to support a use case where the document is configured with sync server,// and we need to override it with config from config.inireturn !!syncServerHost && syncServerHost !== 'disabled';},diff --git a/src/services/sync_update.js b/src/services/sync_update.jsindex 48e09bf234..fcd3cf1afb 100644--- a/src/services/sync_update.js+++ b/src/services/sync_update.js@@ -93,8 +93,8 @@ function updateNoteReordering(entityChange, entity, instanceId) {}function handleContent(content) {- // we always use Buffer object which is different from normal saving - there we use simple string type for- // "string notes". The problem is that in general it's not possible to detect whether a blob content+ // we always use a Buffer object which is different from normal saving - there we use a simple string type for+ // "string notes". The problem is that in general, it's not possible to detect whether a blob content// is string note or note (syncs can arrive out of order)content = content === null ? null : Buffer.from(content, 'base64');diff --git a/src/services/task_context.js b/src/services/task_context.jsindex 363bd3035c..13fc22b04e 100644--- a/src/services/task_context.js+++ b/src/services/task_context.js@@ -14,10 +14,10 @@ class TaskContext {// progressCount is meant to represent just some progress - to indicate the task is not stuckthis.progressCount = -1; // we're incrementing immediatelly- this.lastSentCountTs = 0; // 0 will guarantee first message will be sent+ this.lastSentCountTs = 0; // 0 will guarantee the first message will be sent// just the fact this has been initialized is a progress which should be sent to clients- // this is esp. important when importing big files/images which take long time to upload/process+ // this is esp. important when importing big files/images which take a long time to upload/process// which means that first "real" increaseProgressCount() will be called quite late and user is without// feedback until thenthis.increaseProgressCount();diff --git a/src/services/tree.js b/src/services/tree.jsindex 5d183cbca5..0feeba2642 100644--- a/src/services/tree.js+++ b/src/services/tree.js@@ -87,7 +87,7 @@ function sortNotes(parentNoteId, customSortBy = 'title', reverse = false, folderconst bHasChildren = b.hasChildren();if ((aHasChildren && !bHasChildren) || (!aHasChildren && bHasChildren)) {- // exactly one note of the two is a directory so the sorting will be done based on this status+ // exactly one note of the two is a directory, so the sorting will be done based on this statusreturn aHasChildren ? -1 : 1;}}diff --git a/src/services/window.js b/src/services/window.jsindex 4e26f362e6..3e09fd1394 100644--- a/src/services/window.js+++ b/src/services/window.js@@ -9,7 +9,7 @@ const cls = require('./cls');const keyboardActionsService = require('./keyboard_actions');const {ipcMain} = require('electron');-// Prevent window being garbage collected+// Prevent the window being garbage collected/** @type {Electron.BrowserWindow} */let mainWindow;/** @type {Electron.BrowserWindow} */@@ -48,7 +48,7 @@ async function createMainWindow(app) {const windowStateKeeper = require('electron-window-state'); // should not be statically importedconst mainWindowState = windowStateKeeper({- // default window width & height, so it's usable on 1600 * 900 display (including some extra panels etc.)+ // default window width & height, so it's usable on a 1600 * 900 display (including some extra panels etc.)defaultWidth: 1200,defaultHeight: 800});diff --git a/src/services/ws.js b/src/services/ws.jsindex 0ab6a4ffe9..6f613b0593 100644--- a/src/services/ws.js+++ b/src/services/ws.js@@ -185,7 +185,7 @@ function sendPing(client, entityChangeIds = []) {// sort entity changes since froca expects "referential order", i.e. referenced entities should already exist// in froca.- // Froca needs this since it is incomplete copy, it can't create "skeletons" like becca.+ // Froca needs this since it is an incomplete copy, it can't create "skeletons" like becca.entityChanges.sort((a, b) => ORDERING[a.entityName] - ORDERING[b.entityName]);for (const entityChange of entityChanges) {diff --git a/src/share/routes.js b/src/share/routes.jsindex 2191413d18..d807ce35eb 100644--- a/src/share/routes.js+++ b/src/share/routes.js@@ -16,7 +16,7 @@ function getSharedSubTreeRoot(note) {}// every path leads to share root, but which one to choose?- // for sake of simplicity URLs are not note paths+ // for the sake of simplicity, URLs are not note pathsconst parentNote = note.getParentNotes()[0];if (parentNote.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {@@ -50,7 +50,7 @@ function checkAttachmentAccess(attachmentId, req, res) {const note = checkNoteAccess(attachment.parentId, req, res);- // truthy note means user has access, and we can return the attachment+ // truthy note means the user has access, and we can return the attachmentreturn note ? attachment : false;}diff --git a/src/share/shaca/entities/snote.js b/src/share/shaca/entities/snote.jsindex adfc5d02e0..05dba63bb9 100644--- a/src/share/shaca/entities/snote.js+++ b/src/share/shaca/entities/snote.js@@ -330,7 +330,8 @@ class SNote extends AbstractShacaEntity {/*** @param {string} type - attribute type (label, relation, etc.)* @param {string} name - attribute name- * @returns {SAttribute} 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 {SAttribute} 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();@@ -341,7 +342,7 @@ class SNote extends AbstractShacaEntity {/*** @param {string} type - attribute type (label, relation, etc.)* @param {string} name - attribute name- * @returns {string|null} attribute value of given type and name or null if no such attribute exists.+ * @returns {string|null} attribute value of the given type and name or null if no such attribute exists.*/getAttributeValue(type, name) {const attr = this.getAttribute(type, name);@@ -352,7 +353,7 @@ class SNote extends AbstractShacaEntity {/*** @param {string} type - attribute type (label, relation, etc.)* @param {string} name - attribute name- * @returns {string|null} attribute value of given type and name or null if no such attribute exists.+ * @returns {string|null} attribute value of the given type and name or null if no such attribute exists.*/getOwnedAttributeValue(type, name) {const attr = this.getOwnedAttribute(type, name);diff --git a/src/share/shaca/shaca_loader.js b/src/share/shaca/shaca_loader.jsindex 361db0cc0f..09bc7a92bd 100644--- a/src/share/shaca/shaca_loader.js+++ b/src/share/shaca/shaca_loader.js@@ -14,7 +14,7 @@ function load() {const start = Date.now();shaca.reset();- // using raw query and passing arrays to avoid allocating new objects+ // using a raw query and passing arrays to avoid allocating new objectsconst noteIds = sql.getColumn(`WITH RECURSIVEdiff --git a/src/tools/generate_document.js b/src/tools/generate_document.jsindex 80073137ea..e716e7e016 100644--- a/src/tools/generate_document.js+++ b/src/tools/generate_document.js@@ -1,6 +1,6 @@/*** Usage: node src/tools/generate_document.js 1000- * will create 1000 new notes and some clones into a current document.db+ * will create 1000 new notes and some clones into the current document.db*/require('../becca/entity_constructor');diff --git a/src/views/setup.ejs b/src/views/setup.ejsindex 185df189fa..80902e5ece 100644--- a/src/views/setup.ejs+++ b/src/views/setup.ejs@@ -55,15 +55,15 @@<div id="setup-type" data-bind="visible: step() == 'setup-type'" style="margin-top: 20px;"><div class="radio" style="margin-bottom: 15px;"><label><input type="radio" name="setup-type" value="new-document" data-bind="checked: setupType">- I'm a new user, and I want to create new Trilium document for my notes</label>+ I'm a new user, and I want to create a new Trilium document for my notes</label></div><div class="radio" style="margin-bottom: 15px;"><label><input type="radio" name="setup-type" value="sync-from-desktop" data-bind="checked: setupType">- I have desktop instance already, and I want to set up sync with it</label>+ I have a desktop instance already, and I want to set up sync with it</label></div><div class="radio" style="margin-bottom: 15px;"><label><input type="radio" name="setup-type" value="sync-from-server" data-bind="checked: setupType">- I have server instance already, and I want to set up sync with it</label>+ I have a server instance already, and I want to set up sync with it</label></div><button type="button" data-bind="disable: !setupTypeSelected(), click: selectSetupType" class="btn btn-primary">Next</button>diff --git a/src/www b/src/wwwindex 1cfbff9e09..1dc081befd 100644--- a/src/www+++ b/src/www@@ -43,7 +43,7 @@ function startTrilium() {/*** The intended behavior is to detect when a second instance is running, in that case open the old instance* instead of the new one. This is complicated by the fact that it is possible to run multiple instances of Trilium- * if port and data dir is configured separately. This complication is the source of the following weird usage.+ * if port and data dir are configured separately. This complication is the source of the following weird usage.** The line below makes sure that the "second-instance" (process in window.js) is fired. Normally it returns a boolean* indicating whether another instance is running or not, but we ignore that and kill the app only based on the port conflict.