diff --git a/src/becca/becca_service.js b/src/becca/becca_service.js index aad6fff5b..15a1c07cc 100644 --- a/src/becca/becca_service.js +++ b/src/becca/becca_service.js @@ -54,7 +54,7 @@ function getNoteTitleArrayForPath(notePathArray) { let parentNoteId = 'root'; let hoistedNotePassed = false; - // this is a notePath from outside of hoisted subtree so full title path needs to be returned + // this is a notePath from outside of hoisted subtree, so the full title path needs to be returned const hoistedNoteId = cls.getHoistedNoteId(); const outsideOfHoistedSubtree = !notePathArray.includes(hoistedNoteId); diff --git a/src/becca/entities/battachment.js b/src/becca/entities/battachment.js index 118e617fc..79a23b0fb 100644 --- a/src/becca/entities/battachment.js +++ b/src/becca/entities/battachment.js @@ -119,7 +119,7 @@ class BAttachment extends AbstractBeccaEntity { throw new Error(`Mapping from attachment role '${this.role}' to note's type is not defined`); } - if (!this.isContentAvailable()) { // isProtected is same for attachment + if (!this.isContentAvailable()) { // isProtected is the same for attachment throw new Error(`Cannot convert protected attachment outside of protected session`); } diff --git a/src/becca/entities/bbranch.js b/src/becca/entities/bbranch.js index cfd855d47..43574fd46 100644 --- a/src/becca/entities/bbranch.js +++ b/src/becca/entities/bbranch.js @@ -224,7 +224,7 @@ class BBranch extends AbstractBeccaEntity { for (const childBranch of this.parentNote.getChildBranches()) { if (maxNotePos < childBranch.notePosition - && childBranch.noteId !== '_hidden' // hidden has very large notePosition to always stay last + && childBranch.noteId !== '_hidden' // hidden has a very large notePosition to always stay last ) { maxNotePos = childBranch.notePosition; } diff --git a/src/becca/entities/bnote_revision.js b/src/becca/entities/bnote_revision.js index 982bdc497..190b0fa9a 100644 --- a/src/becca/entities/bnote_revision.js +++ b/src/becca/entities/bnote_revision.js @@ -9,7 +9,7 @@ const sql = require("../../services/sql"); const BAttachment = require("./battachment"); /** - * NoteRevision represents snapshot of note's title and content at some point in the past. + * NoteRevision represents a snapshot of note's title and content at some point in the past. * It's used for seamless note versioning. * * @extends AbstractBeccaEntity @@ -73,7 +73,7 @@ class BNoteRevision extends AbstractBeccaEntity { /* * Note revision content has quite special handling - it's not a separate entity, but a lazily loaded - * part of NoteRevision entity with its own sync. Reason behind this hybrid design is that + * part of NoteRevision entity with its own sync. The reason behind this hybrid design is that * content can be quite large, and it's not necessary to load it / fill memory for any note access even * if we don't need a content, especially for bulk operations like search. * diff --git a/src/public/app/components/entrypoints.js b/src/public/app/components/entrypoints.js index c09c45fbc..fb6e07d66 100644 --- a/src/public/app/components/entrypoints.js +++ b/src/public/app/components/entrypoints.js @@ -158,7 +158,7 @@ export default class Entrypoints extends Component { async runActiveNoteCommand() { const {ntxId, note} = appContext.tabManager.getActiveContext(); - // ctrl+enter is also used elsewhere so make sure we're running only when appropriate + // ctrl+enter is also used elsewhere, so make sure we're running only when appropriate if (!note || note.type !== 'code') { return; } diff --git a/src/public/app/components/main_tree_executors.js b/src/public/app/components/main_tree_executors.js index f718ca7a6..956d652c8 100644 --- a/src/public/app/components/main_tree_executors.js +++ b/src/public/app/components/main_tree_executors.js @@ -5,7 +5,7 @@ import hoistedNoteService from "../services/hoisted_note.js"; import Component from "./component.js"; /** - * This class contains command executors which logically belong to the NoteTree widget, but for better user experience + * This class contains command executors which logically belong to the NoteTree widget, but for better user experience, * the keyboard shortcuts must be active on the whole screen and not just on the widget itself, so the executors * must be at the root of the component tree. */ diff --git a/src/public/app/components/note_context.js b/src/public/app/components/note_context.js index ed2531db6..94e917035 100644 --- a/src/public/app/components/note_context.js +++ b/src/public/app/components/note_context.js @@ -106,7 +106,7 @@ class NoteContext extends Component { } isMainContext() { - // if null then this is a main context + // if null, then this is a main context return !this.mainNtxId; } @@ -127,7 +127,7 @@ class NoteContext extends Component { saveToRecentNotes(resolvedNotePath) { setTimeout(async () => { - // we include the note into recent list only if the user stayed on the note at least 5 seconds + // we include the note in the recent list only if the user stayed on the note at least 5 seconds if (resolvedNotePath && resolvedNotePath === this.notePath) { await server.post('recent-notes', { noteId: this.note.noteId, @@ -172,7 +172,7 @@ class NoteContext extends Component { getPojoState() { if (!this.notePath && this.hoistedNoteId === 'root') { - // keeping empty hoisted tab is esp. important for mobile (e.g. opened launcher config) + // keeping empty hoisted tab is esp. important for mobile (e.g., opened launcher config) return null; } @@ -288,7 +288,7 @@ class NoteContext extends Component { resetViewScope() { // view scope contains data specific to one note context and one "view". - // it is used to e.g. make read-only note temporarily editable or to hide TOC + // it is used to e.g., make read-only note temporarily editable or to hide TOC // this is reset after navigating to a different note this.viewScope = {}; } diff --git a/src/public/app/doc_notes/launchbar_note_launcher.html b/src/public/app/doc_notes/launchbar_note_launcher.html index 74b28296a..3c68ad82a 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 @@
keyboardLauncher
- optional, pressing the keyboard launcher will open the noteLaunchbar displays the title / icon from the launcher which does not necessarily mirrors those of the target note.
+Launchbar displays the title / icon from the launcher which does not necessarily mirror those of the target note.
diff --git a/src/public/app/entities/fnote.js b/src/public/app/entities/fnote.js index 3d8bb034f..506e466bb 100644 --- a/src/public/app/entities/fnote.js +++ b/src/public/app/entities/fnote.js @@ -195,7 +195,7 @@ class FNote { } // will sort the parents so that non-search & non-archived are first and archived at the end - // this is done so that non-search & non-archived paths are always explored as first when looking for note path + // this is done so that non-search & non-archived paths are always explored as first when looking for a note path sortParents() { this.parents.sort((aNoteId, bNoteId) => { const aBranchId = this.parentToBranch[aNoteId]; @@ -360,7 +360,7 @@ class FNote { 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) { @@ -400,7 +400,7 @@ class FNote { } /** - * Returns note path considered to be the "best" + * Returns the note path considered to be the "best" * * @param {string} [hoistedNoteId='root'] * @return {string[]} array of noteIds constituting the particular note path @@ -410,7 +410,7 @@ class FNote { } /** - * Returns note path considered to be the "best" + * Returns the note path considered to be the "best" * * @param {string} [hoistedNoteId='root'] * @return {string} serialized note path (e.g. 'root/a1h315/js725h') @@ -553,7 +553,7 @@ class FNote { // we're not checking hideArchivedNotes since that would mean we need to lazy load the child notes // which would seriously slow down everything. // we check this flag only once user chooses to expand the parent. This has the negative consequence that - // note may appear as folder but not contain any children when all of them are archived + // note may appear as a folder but not contain any children when all of them are archived return childBranches; } @@ -597,7 +597,7 @@ class FNote { /** * @param {string} type - attribute type (label, relation, etc.) * @param {string} name - attribute name - * @returns {FAttribute} 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 {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(); @@ -608,7 +608,7 @@ class FNote { /** * @param {string} type - attribute type (label, relation, etc.) * @param {string} name - attribute name - * @returns {FAttribute} 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 {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(); @@ -619,7 +619,7 @@ class FNote { /** * @param {string} type - attribute type (label, relation, etc.) * @param {string} name - attribute name - * @returns {string} attribute value of given type and name or null if no such attribute exists. + * @returns {string} attribute value of the given type and name or null if no such attribute exists. */ getOwnedAttributeValue(type, name) { const attr = this.getOwnedAttribute(type, name); @@ -630,7 +630,7 @@ class FNote { /** * @param {string} type - attribute type (label, relation, etc.) * @param {string} name - attribute name - * @returns {string} attribute value of given type and name or null if no such attribute exists. + * @returns {string} attribute value of the given type and name or null if no such attribute exists. */ getAttributeValue(type, name) { const attr = this.getAttribute(type, name); @@ -774,7 +774,7 @@ class FNote { return def && def.isPromoted; }); - // attrs are not resorted if position changes after initial load + // attrs are not resorted if position changes after the initial load promotedAttrs.sort((a, b) => { if (a.noteId === b.noteId) { return a.position < b.position ? -1 : 1; diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.js index cff7f91cc..afb3ab606 100644 --- a/src/public/app/layouts/desktop_layout.js +++ b/src/public/app/layouts/desktop_layout.js @@ -128,8 +128,8 @@ export default class DesktopLayout { ) .child( new RibbonContainer() - // order of the widgets matter. Some of these want to "activate" themselves - // when visible, when this happens to multiple of them, the first one "wins". + // the order of the widgets matter. Some of these want to "activate" themselves + // when visible. When this happens to multiple of them, the first one "wins". // promoted attributes should always win. .ribbon(new PromotedAttributesWidget()) .ribbon(new ScriptExecutorWidget()) diff --git a/src/public/app/services/attribute_parser.js b/src/public/app/services/attribute_parser.js index 3b89bce8d..9665e3579 100644 --- a/src/public/app/services/attribute_parser.js +++ b/src/public/app/services/attribute_parser.js @@ -67,7 +67,7 @@ function lex(str) { finishWord(i - 1); } else { - // it's a quote but within other kind of quotes, so it's valid as a literal character + // it's a quote, but within other kind of quotes, so it's valid as a literal character currentWord += chr; } continue; diff --git a/src/public/app/services/attribute_renderer.js b/src/public/app/services/attribute_renderer.js index 973a9a841..fcbd7520b 100644 --- a/src/public/app/services/attribute_renderer.js +++ b/src/public/app/services/attribute_renderer.js @@ -17,7 +17,7 @@ async function renderAttribute(attribute, renderIsInheritable) { return $attr; } - // when the relation has just been created then it might not have a value + // when the relation has just been created, then it might not have a value if (attribute.value) { $attr.append(document.createTextNode(`~${attribute.name}${isInheritable}=`)); $attr.append(await createNoteLink(attribute.value)); diff --git a/src/public/app/services/branches.js b/src/public/app/services/branches.js index b0cf129a2..74465ea1b 100644 --- a/src/public/app/services/branches.js +++ b/src/public/app/services/branches.js @@ -237,7 +237,7 @@ async function cloneNoteToParentNote(childNoteId, parentNoteId, prefix) { } } -// beware that first arg is noteId and second is branchId! +// beware that the first arg is noteId and the second is branchId! async function cloneNoteAfter(noteId, afterBranchId) { const resp = await server.put(`notes/${noteId}/clone-after/${afterBranchId}`); diff --git a/src/public/app/services/froca.js b/src/public/app/services/froca.js index 929f4f5c0..a5c08ec87 100644 --- a/src/public/app/services/froca.js +++ b/src/public/app/services/froca.js @@ -24,7 +24,7 @@ class Froca { async loadInitialTree() { const resp = await server.get('tree'); - // clear the cache only directly before adding new content which is important for e.g. switching to protected session + // clear the cache only directly before adding new content which is important for e.g., switching to protected session /** @type {Object.), then just make it empty - // this is important when setting new note to code + // this is important when setting a new note to code return { content: utils.isHtmlEmpty(content) ? '' : content }; diff --git a/src/routes/api/branches.js b/src/routes/api/branches.js index 0c1f1f34e..5838f6083 100644 --- a/src/routes/api/branches.js +++ b/src/routes/api/branches.js @@ -13,7 +13,7 @@ const ValidationError = require("../../errors/validation_error"); const NotFoundError = require("../../errors/not_found_error"); /** - * Code in this file deals with moving and cloning branches. Relationship between note and parent note is unique + * Code in this file deals with moving and cloning branches. The relationship between note and parent note is unique * for not deleted branches. There may be multiple deleted note-parent note relationships. */ @@ -80,7 +80,7 @@ function moveBranchBeforeNote(req) { treeService.sortNotesIfNeeded(parentNote.noteId); - // if sorting is not needed then still the ordering might have changed above manually + // if sorting is not needed, then still the ordering might have changed above manually entityChangesService.addNoteReorderingEntityChange(parentNote.noteId); log.info(`Moved note ${branchToMove.noteId}, branch ${branchId} before note ${beforeBranch.noteId}, branch ${beforeBranchId}`); @@ -131,7 +131,7 @@ function moveBranchAfterNote(req) { treeService.sortNotesIfNeeded(parentNote.noteId); - // if sorting is not needed then still the ordering might have changed above manually + // if sorting is not needed, then still the ordering might have changed above manually entityChangesService.addNoteReorderingEntityChange(parentNote.noteId); log.info(`Moved note ${branchToMove.noteId}, branch ${branchId} after note ${afterNote.noteId}, branch ${afterBranchId}`); diff --git a/src/routes/api/files.js b/src/routes/api/files.js index 1046baeda..842ee2dd8 100644 --- a/src/routes/api/files.js +++ b/src/routes/api/files.js @@ -106,7 +106,7 @@ const downloadAttachment = (req, res) => downloadAttachmentInt(req.params.attach const openAttachment = (req, res) => downloadAttachmentInt(req.params.attachmentId, res, false); function fileContentProvider(req) { - // Read file name from route params. + // Read the file name from route params. const note = becca.getNote(req.params.noteId); if (!note) { throw new NotFoundError(`Note '${req.params.noteId}' doesn't exist.`); @@ -116,7 +116,7 @@ function fileContentProvider(req) { } function attachmentContentProvider(req) { - // Read file name from route params. + // Read the file name from route params. const attachment = becca.getAttachment(req.params.attachmentId); if (!attachment) { throw new NotFoundError(`Attachment '${req.params.attachmentId}' doesn't exist.`); diff --git a/src/routes/api/import.js b/src/routes/api/import.js index 7edcb0ff1..b60c32cb9 100644 --- a/src/routes/api/import.js +++ b/src/routes/api/import.js @@ -72,7 +72,7 @@ async function importToBranch(req) { } if (last === "true") { - // small timeout to avoid race condition (message is received before the transaction is committed) + // small timeout to avoid race condition (the message is received before the transaction is committed) setTimeout(() => taskContext.taskSucceeded({ parentNoteId: parentNoteId, importedNoteId: note.noteId diff --git a/src/routes/custom.js b/src/routes/custom.js index c99db4066..69eeebeeb 100644 --- a/src/routes/custom.js +++ b/src/routes/custom.js @@ -61,7 +61,7 @@ function handleRequest(req, res) { throw new Error(`Unrecognized attribute name '${attr.name}'`); } - return; // only first handler is executed + return; // only the first handler is executed } const message = `No handler matched for custom '${path}' request.`; diff --git a/src/services/app_icon.js b/src/services/app_icon.js index a749c53fa..34ff69e60 100644 --- a/src/services/app_icon.js +++ b/src/services/app_icon.js @@ -29,7 +29,7 @@ function installLocalAppIcon() { } if (!fs.existsSync(path.resolve(ELECTRON_APP_ROOT_DIR, "trilium-portable.sh"))) { - // simple heuristic to detect ".tar.xz" linux build (i.e. not flatpak, not debian) + // simple heuristic to detect ".tar.xz" linux build (i.e., not flatpak, not debian) // only in such case it's necessary to create an icon return; } diff --git a/src/services/cls.js b/src/services/cls.js index 33845e2b5..462f13e8e 100644 --- a/src/services/cls.js +++ b/src/services/cls.js @@ -63,7 +63,7 @@ function addEntityChange(entityChange) { const entityChangeIds = namespace.get('entityChangeIds') || []; - // store only ID since the record can be modified (e.g. in erase) + // store only ID since the record can be modified (e.g., in erase) entityChangeIds.push(entityChange.id); namespace.set('entityChangeIds', entityChangeIds); diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.js index fb51265a5..b4bbe7053 100644 --- a/src/services/consistency_checks.js +++ b/src/services/consistency_checks.js @@ -239,11 +239,11 @@ class ConsistencyChecks { } findExistencyIssues() { - // principle for fixing inconsistencies is that if the note itself is deleted (isDeleted=true) then all related - // entities should be also deleted (branches, attributes), but if note is not deleted, + // the principle for fixing inconsistencies is that if the note itself is deleted (isDeleted=true) then all related + // entities should be also deleted (branches, attributes), but if the note is not deleted, // then at least one branch should exist. - // the order here is important - first we might need to delete inconsistent branches and after that + // the order here is important - first we might need to delete inconsistent branches, and after that // another check might create missing branch this.findAndFixIssues(` SELECT branchId, @@ -376,7 +376,7 @@ class ConsistencyChecks { ({noteId, type}) => { if (this.autoFix) { const note = becca.getNote(noteId); - note.type = 'file'; // file is a safe option to recover notes if type is not known + note.type = 'file'; // file is a safe option to recover notes if the type is not known note.save(); this.reloadNeeded = true; @@ -613,7 +613,7 @@ class ConsistencyChecks { entityChangesService.addEntityChange({ entityName, entityId, - hash: utils.randomString(10), // doesn't matter, will force sync but that's OK + hash: utils.randomString(10), // doesn't matter, will force sync, but that's OK isErased: !!entity.isErased, utcDateChanged: entity.utcDateModified || entity.utcDateCreated, isSynced: entityName !== 'options' || entity.isSynced @@ -690,7 +690,7 @@ class ConsistencyChecks { // - just SQL query will fix it in DB but not notify frontend (or other caches) that it has been fixed // - renaming the attribute would break the invariant that single attribute never changes the name // - deleting the old attribute and creating new will create duplicates across synchronized cluster (specifically in the initial migration) - // But in general we assume there won't be many such problems + // But in general, we assume there won't be many such problems sql.execute('UPDATE attributes SET name = ? WHERE name = ?', [fixedName, origName]); this.fixedIssues = true; @@ -804,7 +804,7 @@ class ConsistencyChecks { function getBlankContent(isProtected, type, mime) { if (isProtected) { - return null; // this is wrong for protected non-erased notes, but we cannot create a valid value without password + return null; // this is wrong for protected non-erased notes, but we cannot create a valid value without a password } if (mime === 'application/json') { diff --git a/src/services/data_dir.js b/src/services/data_dir.js index 27e62f0db..7971eabf4 100644 --- a/src/services/data_dir.js +++ b/src/services/data_dir.js @@ -5,7 +5,7 @@ * - if TRILIUM_DATA_DIR environment variable exists, then its value is used as the path * - if "trilium-data" dir exists directly in the home dir, then it is used * - based on OS convention, if the "app data directory" exists, we'll use or create "trilium-data" directory there - * - as a fallback if previous step fails, we'll use home dir + * - as a fallback if the previous step fails, we'll use home dir */ const os = require('os'); diff --git a/src/services/data_encryption.js b/src/services/data_encryption.js index d75d62d3b..12398ffc7 100644 --- a/src/services/data_encryption.js +++ b/src/services/data_encryption.js @@ -13,7 +13,7 @@ function arraysIdentical(a, b) { } function shaArray(content) { - // we use this as simple checksum and don't rely on its security so SHA-1 is good enough + // we use this as a simple checksum and don't rely on its security, so SHA-1 is good enough return crypto.createHash('sha1').update(content).digest(); } diff --git a/src/services/date_utils.js b/src/services/date_utils.js index 6c39ac1b1..f35ffd28a 100644 --- a/src/services/date_utils.js +++ b/src/services/date_utils.js @@ -6,7 +6,7 @@ function utcNowDateTime() { } // CLS date time is important in web deployments - server often runs in different time zone than user is located in, -// so we'd prefer client timezone to be used to record local dates. For this reason requests from client contain +// so we'd prefer client timezone to be used to record local dates. For this reason, requests from clients contain // "trilium-local-now-datetime" header which is then stored in CLS function localNowDateTime() { return cls.getLocalNowDateTime() diff --git a/src/services/handlers.js b/src/services/handlers.js index 766cf2f6c..e44e3ff5f 100644 --- a/src/services/handlers.js +++ b/src/services/handlers.js @@ -12,7 +12,7 @@ function runAttachedRelations(note, relationName, originEntity) { return; } - // same script note can get here with multiple ways, but execute only once + // the same script note can get here with multiple ways, but execute only once const notesToRun = new Set( note.getRelations(relationName) .map(relation => relation.getTargetNote()) @@ -203,7 +203,7 @@ eventService.subscribe(eventService.ENTITY_CHANGED, ({ entityName, entity }) => eventService.subscribe(eventService.ENTITY_DELETED, ({ entityName, entity }) => { processInverseRelations(entityName, entity, (definition, note, targetNote) => { - // if one inverse attribute is deleted then the other should be deleted as well + // if one inverse attribute is deleted, then the other should be deleted as well const relations = targetNote.getOwnedRelations(definition.inverseRelation); for (const relation of relations) { diff --git a/src/services/hidden_subtree.js b/src/services/hidden_subtree.js index a4f69cbe4..47d72dc18 100644 --- a/src/services/hidden_subtree.js +++ b/src/services/hidden_subtree.js @@ -15,8 +15,8 @@ const LBTPL_CUSTOM_WIDGET = "_lbTplCustomWidget"; /* * Hidden subtree is generated as a "predictable structure" which means that it avoids generating random IDs to always - * produce same structure. This is needed because it is run on multiple instances in the sync cluster which might produce - * duplicate subtrees. This way, all instances will generate the same structure with same IDs. + * produce the same structure. This is needed because it is run on multiple instances in the sync cluster which might produce + * duplicate subtrees. This way, all instances will generate the same structure with the same IDs. */ const HIDDEN_SUBTREE_DEFINITION = { @@ -24,7 +24,7 @@ const HIDDEN_SUBTREE_DEFINITION = { title: 'Hidden Notes', type: 'doc', icon: 'bx bx-chip', - // we want to keep the hidden subtree always last, otherwise there will be problems with e.g. keyboard navigation + // we want to keep the hidden subtree always last, otherwise there will be problems with e.g., keyboard navigation // over tree when it's in the middle notePosition: 999_999_999, attributes: [ @@ -298,14 +298,14 @@ function checkHiddenSubtreeRecursively(parentNoteId, item) { } if (note.type !== item.type) { - // enforce correct note type + // enforce a correct note type note.type = item.type; note.save(); } if (branch) { // in case of launchers the branch ID is not preserved and should not be relied upon - launchers which move between - // visible and available will change branch since branch's parent-child relationship is immutable + // visible and available will change branch since the branch's parent-child relationship is immutable if (item.notePosition !== undefined && branch.notePosition !== item.notePosition) { branch.notePosition = item.notePosition; branch.save(); diff --git a/src/services/html_sanitizer.js b/src/services/html_sanitizer.js index 4693ee1df..74f7aab15 100644 --- a/src/services/html_sanitizer.js +++ b/src/services/html_sanitizer.js @@ -2,8 +2,8 @@ const sanitizeHtml = require('sanitize-html'); const sanitizeUrl = require('@braintree/sanitize-url').sanitizeUrl; // intended mainly as protection against XSS via import -// secondarily it (partly) protects against "CSS takeover" -// sanitize also note titles, label values etc. - there's so many usage which make it difficult to guarantee all of them +// secondarily, it (partly) protects against "CSS takeover" +// sanitize also note titles, label values etc. - there are so many usages which make it difficult to guarantee all of them // are properly handled function sanitize(dirtyHtml) { if (!dirtyHtml) { diff --git a/src/services/image.js b/src/services/image.js index 51fbab4b1..010a2892b 100644 --- a/src/services/image.js +++ b/src/services/image.js @@ -191,8 +191,8 @@ async function shrinkImage(buffer, originalName) { finalImageBuffer = buffer; } - // if resizing did not help with size then save the original - // (can happen when e.g. resizing PNG into JPEG) + // if resizing did not help with size, then save the original + // (can happen when e.g., resizing PNG into JPEG) if (finalImageBuffer.byteLength >= buffer.byteLength) { finalImageBuffer = buffer; } @@ -216,7 +216,7 @@ async function resize(buffer, quality) { image.quality(quality); - // when converting PNG to JPG we lose alpha channel, this is replaced by white to match Trilium white background + // when converting PNG to JPG, we lose the alpha channel, this is replaced by white to match Trilium white background image.background(0xFFFFFFFF); const resultBuffer = await image.getBufferAsync(jimp.MIME_JPEG); diff --git a/src/services/import/enex.js b/src/services/import/enex.js index d0199bbdb..538cf9246 100644 --- a/src/services/import/enex.js +++ b/src/services/import/enex.js @@ -317,8 +317,8 @@ function importEnex(taskContext, file, parentNote) { content = content.replace(mediaRegex, imageLink); if (!content.includes(imageLink)) { - // if there wasn't any match for the reference, we'll add the image anyway - // otherwise image would be removed since no note would include it + // if there wasn't any match for the reference, we'll add the image anyway, + // otherwise the image would be removed since no note would include it content += imageLink; } } catch (e) { diff --git a/src/services/migration.js b/src/services/migration.js index 7bda5bc36..cbe8688d2 100644 --- a/src/services/migration.js +++ b/src/services/migration.js @@ -45,7 +45,7 @@ async function migrate() { migrations.sort((a, b) => a.dbVersion - b.dbVersion); - // all migrations are executed in one transaction - upgrade either succeeds or the user can stay at the old version + // all migrations are executed in one transaction - upgrade either succeeds, or the user can stay at the old version // otherwise if half of the migrations succeed, user can't use any version - DB is too "new" for the old app, // and too old for the new app version. sql.transactional(() => { diff --git a/src/services/search/expressions/is_hidden.js b/src/services/search/expressions/is_hidden.js index 023c69087..9fb59cec3 100644 --- a/src/services/search/expressions/is_hidden.js +++ b/src/services/search/expressions/is_hidden.js @@ -4,7 +4,7 @@ const Expression = require('./expression'); const NoteSet = require('../note_set'); /** - * Note is hidden when all its note paths start in hidden subtree (i.e. the note is not cloned into visible tree) + * Note is hidden when all its note paths start in hidden subtree (i.e., the note is not cloned into visible tree) */ class IsHiddenExp extends Expression { execute(inputNoteSet, executionContext, searchContext) { diff --git a/src/services/search/expressions/note_content_fulltext.js b/src/services/search/expressions/note_content_fulltext.js index 2476754d1..a194ad448 100644 --- a/src/services/search/expressions/note_content_fulltext.js +++ b/src/services/search/expressions/note_content_fulltext.js @@ -91,7 +91,7 @@ class NoteContentFulltextExp extends Expression { const nonMatchingToken = this.tokens.find(token => !content.includes(token) && ( - // in case of default fulltext search we should consider both title, attrs and content + // in case of default fulltext search, we should consider both title, attrs and content // so e.g. "hello world" should match when "hello" is in title and "world" in content !this.flatText || !becca.notes[noteId].getFlatText().includes(token) diff --git a/src/services/search/services/handle_parens.js b/src/services/search/services/handle_parens.js index 6c5889c83..14ff58b0a 100644 --- a/src/services/search/services/handle_parens.js +++ b/src/services/search/services/handle_parens.js @@ -1,5 +1,5 @@ /** - * This will create a recursive object from list of tokens - tokens between parenthesis are grouped in a single array + * This will create a recursive object from a list of tokens - tokens between parenthesis are grouped in a single array */ function handleParens(tokens) { if (tokens.length === 0) { diff --git a/src/services/search/services/lex.js b/src/services/search/services/lex.js index c14816cfb..cefcd53f3 100644 --- a/src/services/search/services/lex.js +++ b/src/services/search/services/lex.js @@ -80,7 +80,7 @@ function lex(str) { quotes = false; } else { - // it's a quote but within other kind of quotes, so it's valid as a literal character + // it's a quote, but within other kind of quotes, so it's valid as a literal character currentWord += chr; }