From af053b61fc373bdc63dd3801209e57d4b338a4b6 Mon Sep 17 00:00:00 2001 From: mechanarchy <1166756+mechanarchy@users.noreply.github.com> Date: Sat, 17 Jun 2023 17:06:17 +1000 Subject: [PATCH 01/16] Ignore SQL comments in query console --- src/routes/api/sql.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/routes/api/sql.js b/src/routes/api/sql.js index 1c853f365..f37b6d310 100644 --- a/src/routes/api/sql.js +++ b/src/routes/api/sql.js @@ -36,6 +36,11 @@ function execute(req) { if (!query) { continue; } + + while (query.startsWith('-- ') { + // Query starts with one or more SQL comments, discard these before we execute. + query = query.substr(query.indexOf('\n') + 1) + } if (query.toLowerCase().startsWith('select') || query.toLowerCase().startsWith('with')) { results.push(sql.getRows(query)); From 8394ce800270d5b843fcc4cea22319420c9c8dff Mon Sep 17 00:00:00 2001 From: manto89 Date: Wed, 21 Jun 2023 13:09:49 +0200 Subject: [PATCH 02/16] Change method when adding a new note. Add reference to new backend method --- src/routes/api/clipper.js | 30 +++++++++++++++++++++++++----- src/routes/routes.js | 1 + 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index d792ff38a..6cf03a519 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -1,6 +1,7 @@ "use strict"; const attributeService = require("../../services/attributes"); +const cloneService = require("../../services/cloning"); const noteService = require('../../services/notes'); const dateNoteService = require('../../services/date_notes'); const dateUtils = require('../../services/date_utils'); @@ -24,7 +25,7 @@ function findClippingNote(clipperInboxNote, pageUrl) { ); for (const note of notes) { - if (note.getOwnedLabelValue('clipType') === 'clippings') { + if (note.getOwnedLabelValue('clipType') === 'note') { return note; } } @@ -43,16 +44,20 @@ function getClipperInboxNote() { } function addClipping(req) { + //if a note under the clipperInbox as the same 'pageUrl' attribute, add the content to that note + //and clone it under today's inbox + //otherwise just create a new note under today's inbox let {title, content, pageUrl, images} = req.body; const clipperInbox = getClipperInboxNote(); pageUrl = htmlSanitizer.sanitizeUrl(pageUrl); let clippingNote = findClippingNote(clipperInbox, pageUrl); - + let dailyNote = dateNoteService.getDayNote(dateUtils.localNowDate()); + if (!clippingNote) { clippingNote = noteService.createNewNote({ - parentNoteId: clipperInbox.noteId, + parentNoteId: dailyNote.noteId, title: title, content: '', type: 'text' @@ -63,12 +68,16 @@ function addClipping(req) { clippingNote.setLabel('iconClass', 'bx bx-globe'); } + const rewrittenContent = processContent(images, clippingNote, content); const existingContent = clippingNote.getContent(); clippingNote.setContent(`${existingContent}${existingContent.trim() ? "
" : ""}${rewrittenContent}`); - + + if (clippingNote.parentNoteId != dailyNote.noteId){ + cloneService.cloneNoteToParentNote(clippingNote.noteId, dailyNote.noteId); + } return { noteId: clippingNote.noteId }; @@ -187,9 +196,20 @@ function handshake() { } } +function findNotesByUrl(req){ + let pageUrl = req.params.noteUrl; + const clipperInbox = getClipperInboxNote(); + let foundPage = findClippingNote(clipperInbox, pageUrl); + return { + noteId: foundPage ? foundPage.noteId : null + } + +} + module.exports = { createNote, addClipping, openNote, - handshake + handshake, + findNotesByUrl }; diff --git a/src/routes/routes.js b/src/routes/routes.js index 2989208b5..764b2746c 100644 --- a/src/routes/routes.js +++ b/src/routes/routes.js @@ -286,6 +286,7 @@ function register(app) { route(POST, '/api/clipper/clippings', clipperMiddleware, clipperRoute.addClipping, apiResultHandler); route(POST, '/api/clipper/notes', clipperMiddleware, clipperRoute.createNote, apiResultHandler); route(POST, '/api/clipper/open/:noteId', clipperMiddleware, clipperRoute.openNote, apiResultHandler); + route(GET, '/api/clipper/notes-by-url/:noteUrl', clipperMiddleware, clipperRoute.findNotesByUrl, apiResultHandler); apiRoute(GET, '/api/similar-notes/:noteId', similarNotesRoute.getSimilarNotes); From 54065672aac470e99bd464e3b24107a3ba175003 Mon Sep 17 00:00:00 2001 From: manto89 Date: Wed, 21 Jun 2023 16:10:06 +0200 Subject: [PATCH 03/16] Normalize behaviour with the other create method for web-clipper --- src/routes/api/clipper.js | 42 ++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index 6cf03a519..310735985 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -37,7 +37,7 @@ function getClipperInboxNote() { let clipperInbox = attributeService.getNoteWithLabel('clipperInbox'); if (!clipperInbox) { - clipperInbox = dateNoteService.getDayNote(dateUtils.localNowDate()); + clipperInbox = dateNoteService.getRootCalendarNote(); } return clipperInbox; @@ -49,11 +49,12 @@ function addClipping(req) { //otherwise just create a new note under today's inbox let {title, content, pageUrl, images} = req.body; + //this is only for reference const clipperInbox = getClipperInboxNote(); + const dailyNote = dateNoteService.getDayNote(dateUtils.localNowDate()); pageUrl = htmlSanitizer.sanitizeUrl(pageUrl); let clippingNote = findClippingNote(clipperInbox, pageUrl); - let dailyNote = dateNoteService.getDayNote(dateUtils.localNowDate()); if (!clippingNote) { clippingNote = noteService.createNewNote({ @@ -91,24 +92,31 @@ function createNote(req) { } const clipperInbox = getClipperInboxNote(); + const dailyNote = dateNoteService.getDayNote(dateUtils.localNowDate()); + pageUrl = htmlSanitizer.sanitizeUrl(pageUrl); + let note = findClippingNote(clipperInbox, pageUrl); - const {note} = noteService.createNewNote({ - parentNoteId: clipperInbox.noteId, - title, - content, - type: 'text' - }); + if (!note){ + note = noteService.createNewNote({ + parentNoteId: dailyNote.noteId, + title, + content, + type: 'text' + }).note; + clipType = htmlSanitizer.sanitize(clipType); - clipType = htmlSanitizer.sanitize(clipType); + note.setLabel('clipType', clipType); + if (pageUrl) { + pageUrl = htmlSanitizer.sanitizeUrl(pageUrl); - note.setLabel('clipType', clipType); + note.setLabel('pageUrl', pageUrl); + note.setLabel('iconClass', 'bx bx-globe'); + } - if (pageUrl) { - pageUrl = htmlSanitizer.sanitizeUrl(pageUrl); - - note.setLabel('pageUrl', pageUrl); - note.setLabel('iconClass', 'bx bx-globe'); } + + + if (labels) { for (const labelName in labels) { @@ -117,9 +125,11 @@ function createNote(req) { } } + const existingContent = note.getContent(); const rewrittenContent = processContent(images, note, content); + note.setContent(`${existingContent}${existingContent.trim() ? "
" : ""}${rewrittenContent}`); - note.setContent(rewrittenContent); + // note.setContent(rewrittenContent); return { noteId: note.noteId From ebccd48013b20a7d72486b46a479d49c5c5f2d32 Mon Sep 17 00:00:00 2001 From: manto89 Date: Wed, 21 Jun 2023 18:05:41 +0200 Subject: [PATCH 04/16] Don't search note by url if url begins with 'about:' --- src/routes/api/clipper.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index 310735985..636d94e21 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -16,17 +16,20 @@ const htmlSanitizer = require('../../services/html_sanitizer'); const {formatAttrForSearch} = require("../../services/attribute_formatter"); function findClippingNote(clipperInboxNote, pageUrl) { - const notes = clipperInboxNote.searchNotesInSubtree( - formatAttrForSearch({ - type: 'label', - name: "pageUrl", - value: pageUrl - }, true) - ); + //Avoid searching for empty of browser pages like about:blank + if (pageUrl.trim().length > 1 && pageUrl.trim().indexOf('about:') != 0 ){ + const notes = clipperInboxNote.searchNotesInSubtree( + formatAttrForSearch({ + type: 'label', + name: "pageUrl", + value: pageUrl + }, true) + ); - for (const note of notes) { - if (note.getOwnedLabelValue('clipType') === 'note') { - return note; + for (const note of notes) { + if (note.getOwnedLabelValue('clipType') === 'note') { + return note; + } } } From afb893c1574d341e955571b96e3a2d981061b6bf Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Thu, 22 Jun 2023 15:38:36 +0800 Subject: [PATCH 05/16] Fix bugs in toc and improve related codes --- src/public/app/widgets/highlights_list.js | 86 ++++++++++--------- src/public/app/widgets/toc.js | 4 +- .../widgets/type_widgets/content_widget.js | 4 +- .../options/text_notes/highlighted_text.js | 40 --------- .../options/text_notes/highlights_list.js | 40 +++++++++ src/routes/api/options.js | 2 +- src/services/options_init.js | 2 +- 7 files changed, 90 insertions(+), 88 deletions(-) delete mode 100644 src/public/app/widgets/type_widgets/options/text_notes/highlighted_text.js create mode 100644 src/public/app/widgets/type_widgets/options/text_notes/highlights_list.js diff --git a/src/public/app/widgets/highlights_list.js b/src/public/app/widgets/highlights_list.js index 4e88e9e45..8d32e7b36 100644 --- a/src/public/app/widgets/highlights_list.js +++ b/src/public/app/widgets/highlights_list.js @@ -10,20 +10,20 @@ import RightPanelWidget from "./right_panel_widget.js"; import options from "../services/options.js"; import OnClickButtonWidget from "./buttons/onclick_button.js"; -const TPL = `
+const TPL = `
- +
`; export default class HighlightsListWidget extends RightPanelWidget { @@ -55,61 +55,61 @@ export default class HighlightsListWidget extends RightPanelWidget { } get widgetTitle() { - return "Highlighted Text"; + return "Highlights List"; } isEnabled() { return super.isEnabled() && this.note.type === 'text' - && !this.noteContext.viewScope.highlightedTextTemporarilyHidden + && !this.noteContext.viewScope.highlightsListTemporarilyHidden && this.noteContext.viewScope.viewMode === 'default'; } async doRenderBody() { this.$body.empty().append($(TPL)); - this.$highlightsList = this.$body.find('.highlists-list'); - this.$body.find('.highlists-list-widget').append(this.closeHltButton.render()); + this.$highlightsList = this.$body.find('.highlights-list'); + this.$body.find('.highlights-list-widget').append(this.closeHltButton.render()); } async refreshWithNote(note) { - /* The reason for adding highlightedTextPreviousVisible is to record whether the previous state - of the highlightedText is hidden or displayed, and then let it be displayed/hidden at the initial time. + /* The reason for adding highlightsListPreviousVisible is to record whether the previous state + of the highlightsList is hidden or displayed, and then let it be displayed/hidden at the initial time. If there is no such value, when the right panel needs to display toc but not highlighttext, every time the note content is changed, highlighttext Widget will appear and then close immediately, because getHlt function will consume time */ - if (this.noteContext.viewScope.highlightedTextPreviousVisible) { + if (this.noteContext.viewScope.highlightsListPreviousVisible) { this.toggleInt(true); } else { this.toggleInt(false); } - const optionsHlt = JSON.parse(options.get('highlightedText')); + const optionsHighlightsList = JSON.parse(options.get('highlightsList')); - if (note.isLabelTruthy('hideHighlightWidget') || !optionsHlt) { + if (note.isLabelTruthy('hideHighlightWidget') || !optionsHighlightsList) { this.toggleInt(false); this.triggerCommand("reEvaluateRightPaneVisibility"); return; } - let $highlightsList = "", hltLiCount = -1; + let $highlightsList = "", hlLiCount = -1; // Check for type text unconditionally in case alwaysShowWidget is set if (this.note.type === 'text') { const {content} = await note.getNoteComplement(); - ({$highlightsList, hltLiCount} = this.getHighlightList(content, optionsHlt)); + ({$highlightsList, hlLiCount} = this.getHighlightList(content, optionsHighlightsList)); } this.$highlightsList.empty().append($highlightsList); - if (hltLiCount > 0) { + if (hlLiCount > 0) { this.toggleInt(true); - this.noteContext.viewScope.highlightedTextPreviousVisible = true; + this.noteContext.viewScope.highlightsListPreviousVisible = true; } else { this.toggleInt(false); - this.noteContext.viewScope.highlightedTextPreviousVisible = false; + this.noteContext.viewScope.highlightsListPreviousVisible = false; } this.triggerCommand("reEvaluateRightPaneVisibility"); } - getHighlightList(content, optionsHlt) { + getHighlightList(content, optionsHighlightsList) { // matches a span containing background-color const regex1 = /]*style\s*=\s*[^>]*background-color:[^>]*?>[\s\S]*?<\/span>/gi; // matches a span containing color @@ -120,27 +120,27 @@ export default class HighlightsListWidget extends RightPanelWidget { const regex4 = /[\s\S]*?<\/strong>/gi; // match underline const regex5 = /[\s\S]*?<\/u>/g; - // Possible values in optionsHlt: '["bold","italic","underline","color","bgColor"]' + // Possible values in optionsHighlightsList: '["bold","italic","underline","color","bgColor"]' // element priority: span>i>strong>u let findSubStr = "", combinedRegexStr = ""; - if (optionsHlt.includes("bgColor")) { - findSubStr += `,span[style*="background-color"]`; + if (optionsHighlightsList.includes("bgColor")) { + findSubStr += `,span[style*="background-color"]:not(section.include-note span[style*="background-color"])`; combinedRegexStr += `|${regex1.source}`; } - if (optionsHlt.includes("color")) { - findSubStr += `,span[style*="color"]`; + if (optionsHighlightsList.includes("color")) { + findSubStr += `,span[style*="color"]:not(section.include-note span[style*="color"])`; combinedRegexStr += `|${regex2.source}`; } - if (optionsHlt.includes("italic")) { - findSubStr += `,i`; + if (optionsHighlightsList.includes("italic")) { + findSubStr += `,i:not(section.include-note i)`; combinedRegexStr += `|${regex3.source}`; } - if (optionsHlt.indexOf("bold")) { - findSubStr += `,strong`; + if (optionsHighlightsList.includes("bold")) { + findSubStr += `,strong:not(section.include-note strong)`; combinedRegexStr += `|${regex4.source}`; } - if (optionsHlt.includes("underline")) { - findSubStr += `,u`; + if (optionsHighlightsList.includes("underline")) { + findSubStr += `,u:not(section.include-note u)`; combinedRegexStr += `|${regex5.source}`; } @@ -148,7 +148,7 @@ export default class HighlightsListWidget extends RightPanelWidget { combinedRegexStr = `(` + combinedRegexStr.substring(1) + `)`; const combinedRegex = new RegExp(combinedRegexStr, 'gi'); const $highlightsList = $("
    "); - let prevEndIndex = -1, hltLiCount = 0; + let prevEndIndex = -1, hlLiCount = 0; for (let match = null, hltIndex = 0; ((match = combinedRegex.exec(content)) !== null); hltIndex++) { const subHtml = match[0]; const startIndex = match.index; @@ -158,16 +158,18 @@ export default class HighlightsListWidget extends RightPanelWidget { $highlightsList.children().last().append(subHtml); } else { // TODO: can't be done with $(subHtml).text()? - const hasText = [...subHtml.matchAll(/(?<=^|>)[^><]+?(?=<|$)/g)].map(matchTmp => matchTmp[0]).join('').trim(); + //Can’t remember why regular expressions are used here, but modified to $(subHtml).text() works as expected + //const hasText = [...subHtml.matchAll(/(?<=^|>)[^><]+?(?=<|$)/g)].map(matchTmp => matchTmp[0]).join('').trim(); + const hasText = $(subHtml).text().trim(); if (hasText) { $highlightsList.append( $('
  1. ') .html(subHtml) - .on("click", () => this.jumpToHighlightedText(findSubStr, hltIndex)) + .on("click", () => this.jumpToHighlightsList(findSubStr, hltIndex)) ); - hltLiCount++; + hlLiCount++; } else { // hide li if its text content is empty continue; @@ -177,11 +179,11 @@ export default class HighlightsListWidget extends RightPanelWidget { } return { $highlightsList, - hltLiCount + hlLiCount }; } - async jumpToHighlightedText(findSubStr, itemIndex) { + async jumpToHighlightsList(findSubStr, itemIndex) { const isReadOnly = await this.noteContext.isReadOnly(); let targetElement; if (isReadOnly) { @@ -224,7 +226,7 @@ export default class HighlightsListWidget extends RightPanelWidget { } async closeHltCommand() { - this.noteContext.viewScope.highlightedTextTemporarilyHidden = true; + this.noteContext.viewScope.highlightsListTemporarilyHidden = true; await this.refresh(); this.triggerCommand('reEvaluateRightPaneVisibility'); } @@ -245,13 +247,13 @@ class CloseHltButton extends OnClickButtonWidget { super(); this.icon("bx-x") - .title("Close HighlightedTextWidget") + .title("Close HighlightsListWidget") .titlePlacement("bottom") .onClick((widget, e) => { e.stopPropagation(); widget.triggerCommand("closeHlt"); }) - .class("icon-action close-highlists-list"); + .class("icon-action close-highlights-list"); } } diff --git a/src/public/app/widgets/toc.js b/src/public/app/widgets/toc.js index 8d66b3294..5253dc112 100644 --- a/src/public/app/widgets/toc.js +++ b/src/public/app/widgets/toc.js @@ -191,7 +191,7 @@ export default class TocWidget extends RightPanelWidget { if (isReadOnly) { const $container = await this.noteContext.getContentElement(); - const headingElement = $container.find(":header")[headingIndex]; + const headingElement = $container.find(":header:not(section.include-note :header)")[headingIndex]; if (headingElement != null) { headingElement.scrollIntoView({ behavior: "smooth" }); @@ -210,7 +210,7 @@ export default class TocWidget extends RightPanelWidget { // navigate (note that the TOC rendering and other TOC // entries' navigation could be wrong too) if (headingNode != null) { - $(textEditor.editing.view.domRoots.values().next().value).find(':header')[headingIndex].scrollIntoView({ + $(textEditor.editing.view.domRoots.values().next().value).find(':header:not(section.include-note :header)')[headingIndex].scrollIntoView({ behavior: 'smooth' }); } diff --git a/src/public/app/widgets/type_widgets/content_widget.js b/src/public/app/widgets/type_widgets/content_widget.js index f7a4846bd..477e0571e 100644 --- a/src/public/app/widgets/type_widgets/content_widget.js +++ b/src/public/app/widgets/type_widgets/content_widget.js @@ -7,7 +7,7 @@ import MaxContentWidthOptions from "./options/appearance/max_content_width.js"; import KeyboardShortcutsOptions from "./options/shortcuts.js"; import HeadingStyleOptions from "./options/text_notes/heading_style.js"; import TableOfContentsOptions from "./options/text_notes/table_of_contents.js"; -import HighlightedTextOptions from "./options/text_notes/highlighted_text.js"; +import HighlightsListOptions from "./options/text_notes/highlights_list.js"; import TextAutoReadOnlySizeOptions from "./options/text_notes/text_auto_read_only_size.js"; import VimKeyBindingsOptions from "./options/code_notes/vim_key_bindings.js"; import WrapLinesOptions from "./options/code_notes/wrap_lines.js"; @@ -62,7 +62,7 @@ const CONTENT_WIDGETS = { _optionsTextNotes: [ HeadingStyleOptions, TableOfContentsOptions, - HighlightedTextOptions, + HighlightsListOptions, TextAutoReadOnlySizeOptions ], _optionsCodeNotes: [ diff --git a/src/public/app/widgets/type_widgets/options/text_notes/highlighted_text.js b/src/public/app/widgets/type_widgets/options/text_notes/highlighted_text.js deleted file mode 100644 index 72d0ccd49..000000000 --- a/src/public/app/widgets/type_widgets/options/text_notes/highlighted_text.js +++ /dev/null @@ -1,40 +0,0 @@ -import OptionsWidget from "../options_widget.js"; - -const TPL = ` -
    -

    Highlighted Text

    - -

    You can customize the highlighted text displayed in the right panel:

    - -
    - - - - - -
-`; - -export default class HighlightedTextOptions extends OptionsWidget { - doRender() { - this.$widget = $(TPL); - this.$hlt = this.$widget.find("input.highlighted-text-check"); - this.$hlt.on('change', () => { - const hltVals = this.$widget.find('input.highlighted-text-check[type="checkbox"]:checked').map(function () { - return this.value; - }).get(); - this.updateOption('highlightedText', JSON.stringify(hltVals)); - }); - } - - async optionsLoaded(options) { - const hltVals = JSON.parse(options.highlightedText); - this.$widget.find('input.highlighted-text-check[type="checkbox"]').each(function () { - if ($.inArray($(this).val(), hltVals) !== -1) { - $(this).prop("checked", true); - } else { - $(this).prop("checked", false); - } - }); - } -} diff --git a/src/public/app/widgets/type_widgets/options/text_notes/highlights_list.js b/src/public/app/widgets/type_widgets/options/text_notes/highlights_list.js new file mode 100644 index 000000000..5e2a2595d --- /dev/null +++ b/src/public/app/widgets/type_widgets/options/text_notes/highlights_list.js @@ -0,0 +1,40 @@ +import OptionsWidget from "../options_widget.js"; + +const TPL = ` +
+

Highlights List

+ +

You can customize the highlights list displayed in the right panel:

+ +
+ + + + + + +`; + +export default class HighlightsListOptions extends OptionsWidget { + doRender() { + this.$widget = $(TPL); + this.$hlt = this.$widget.find("input.highlights-list-check"); + this.$hlt.on('change', () => { + const hltVals = this.$widget.find('input.highlights-list-check[type="checkbox"]:checked').map(function () { + return this.value; + }).get(); + this.updateOption('highlightsList', JSON.stringify(hltVals)); + }); + } + + async optionsLoaded(options) { + const hltVals = JSON.parse(options.highlightsList); + this.$widget.find('input.highlights-list-check[type="checkbox"]').each(function () { + if ($.inArray($(this).val(), hltVals) !== -1) { + $(this).prop("checked", true); + } else { + $(this).prop("checked", false); + } + }); + } +} diff --git a/src/routes/api/options.js b/src/routes/api/options.js index 4d9ee77a2..ba8bc7943 100644 --- a/src/routes/api/options.js +++ b/src/routes/api/options.js @@ -60,7 +60,7 @@ const ALLOWED_OPTIONS = new Set([ 'compressImages', 'downloadImagesAutomatically', 'minTocHeadings', - 'highlightedText', + 'highlightsList', 'checkForUpdates', 'disableTray', 'customSearchEngineName', diff --git a/src/services/options_init.js b/src/services/options_init.js index 358403214..b8026d371 100644 --- a/src/services/options_init.js +++ b/src/services/options_init.js @@ -87,7 +87,7 @@ const defaultOptions = [ { name: 'compressImages', value: 'true', isSynced: true }, { name: 'downloadImagesAutomatically', value: 'true', isSynced: true }, { name: 'minTocHeadings', value: '5', isSynced: true }, - { name: 'highlightedText', value: '["bold","italic","underline","color","bgColor"]', isSynced: true }, + { name: 'highlightsList', value: '["bold","italic","underline","color","bgColor"]', isSynced: true }, { name: 'checkForUpdates', value: 'true', isSynced: true }, { name: 'disableTray', value: 'false', isSynced: false }, { name: 'customSearchEngineName', value: 'Duckduckgo', isSynced: false }, From 712304bbc6a5c0ac37ce0a6699093f6911632c3f Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Fri, 23 Jun 2023 00:26:47 +0800 Subject: [PATCH 06/16] Fix typos Found via `codespell -S ./libraries,./package-lock.json -L tabel,tabels,uptodate,isnt,edn,falsy` --- config-sample.ini | 2 +- src/becca/similarity.js | 2 +- src/etapi/etapi.openapi.yaml | 4 ++-- src/public/app/services/attribute_autocomplete.js | 4 ++-- src/public/app/services/note_autocomplete.js | 2 +- src/public/app/services/note_content_renderer.js | 2 +- src/public/app/services/note_create.js | 2 +- src/public/app/services/note_list_renderer.js | 2 +- src/public/app/services/server.js | 2 +- src/public/app/share.js | 2 +- src/public/app/widgets/bulk_actions/abstract_bulk_action.js | 2 +- src/public/app/widgets/buttons/right_dropdown_button.js | 2 +- src/public/app/widgets/dialogs/delete_notes.js | 2 +- src/public/app/widgets/icon_list.js | 4 ++-- src/public/app/widgets/note_map.js | 2 +- src/public/app/widgets/note_tree.js | 2 +- .../app/widgets/search_options/abstract_search_option.js | 2 +- src/public/app/widgets/type_widgets/canvas.js | 2 +- src/public/app/widgets/type_widgets/options/etapi.js | 2 +- src/public/app/widgets/type_widgets/relation_map.js | 2 +- src/routes/api/recent_notes.js | 2 +- src/routes/api/sync.js | 2 +- src/services/consistency_checks.js | 2 +- src/services/notes.js | 2 +- src/services/script.js | 2 +- src/services/task_context.js | 2 +- src/views/setup.ejs | 2 +- 27 files changed, 30 insertions(+), 30 deletions(-) diff --git a/config-sample.ini b/config-sample.ini index 0e8da0360..d419ed473 100644 --- a/config-sample.ini +++ b/config-sample.ini @@ -16,7 +16,7 @@ noBackup=false # host=0.0.0.0 # port setting is relevant only for web deployments, desktop builds run on a fixed port (changeable with TRILIUM_PORT environment variable) port=8080 -# true for TLS/SSL/HTTPS (secure), false for HTTP (unsecure). +# true for TLS/SSL/HTTPS (secure), false for HTTP (insecure). https=false # path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true certPath= diff --git a/src/becca/similarity.js b/src/becca/similarity.js index 8900bb87d..253a25049 100644 --- a/src/becca/similarity.js +++ b/src/becca/similarity.js @@ -367,7 +367,7 @@ async function findSimilarNotes(noteId) { * We want to improve 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 + * But there's an exception - if they were created really close to each other (within few seconds) then * they are probably part of the import and not created by hand - these OTOH should not benefit. */ const {utcDateCreated} = candidateNote; diff --git a/src/etapi/etapi.openapi.yaml b/src/etapi/etapi.openapi.yaml index 754fb05b3..d5bc48c6c 100644 --- a/src/etapi/etapi.openapi.yaml +++ b/src/etapi/etapi.openapi.yaml @@ -237,7 +237,7 @@ paths: schema: $ref: '#/components/schemas/EntityId' get: - description: Returns note content idenfied by its ID + description: Returns note content identified by its ID operationId: getNoteContent responses: '200': @@ -247,7 +247,7 @@ paths: schema: type: string put: - description: Updates note content idenfied by its ID + description: Updates note content identified by its ID operationId: putNoteContentById requestBody: description: html content of note diff --git a/src/public/app/services/attribute_autocomplete.js b/src/public/app/services/attribute_autocomplete.js index 6780ec7af..ef52ee16a 100644 --- a/src/public/app/services/attribute_autocomplete.js +++ b/src/public/app/services/attribute_autocomplete.js @@ -41,8 +41,8 @@ function initAttributeNameAutocomplete({ $el, attributeType, open }) { async function initLabelValueAutocomplete({ $el, open, nameCallback }) { if ($el.hasClass("aa-input")) { - // we reinit everytime because autocomplete seems to have a bug where it retains state from last - // open even though the value was resetted + // we reinit every time because autocomplete seems to have a bug where it retains state from last + // open even though the value was reset $el.autocomplete('destroy'); } diff --git a/src/public/app/services/note_autocomplete.js b/src/public/app/services/note_autocomplete.js index c548d6f0f..5f19379ee 100644 --- a/src/public/app/services/note_autocomplete.js +++ b/src/public/app/services/note_autocomplete.js @@ -134,7 +134,7 @@ function initNoteAutocomplete($el, options) { showRecentNotes($el); // this will cause the click not give focus to the "show recent notes" button - // this is important because otherwise input will lose focus immediatelly and not show the results + // this is important because otherwise input will lose focus immediately and not show the results return false; }); diff --git a/src/public/app/services/note_content_renderer.js b/src/public/app/services/note_content_renderer.js index 6bb47d9f3..0038bf476 100644 --- a/src/public/app/services/note_content_renderer.js +++ b/src/public/app/services/note_content_renderer.js @@ -137,7 +137,7 @@ async function getRenderedContent(note, options = {}) { $renderedContent.append($content); } else if (type === 'canvas') { - // make sure surrounding container has size of what is visible. Then image is shrinked to its boundaries + // make sure surrounding container has size of what is visible. Then image is shrunk to its boundaries $renderedContent.css({height: "100%", width:"100%"}); const noteComplement = await froca.getNoteComplement(note.noteId); diff --git a/src/public/app/services/note_create.js b/src/public/app/services/note_create.js index e5c593c20..2b925facb 100644 --- a/src/public/app/services/note_create.js +++ b/src/public/app/services/note_create.js @@ -99,7 +99,7 @@ function parseSelectedHtml(selectedHtml) { if (dom.length > 0 && dom[0].tagName && dom[0].tagName.match(/h[1-6]/i)) { const title = $(dom[0]).text(); - // remove the title from content (only first occurence) + // remove the title from content (only first occurrence) const content = selectedHtml.replace(dom[0].outerHTML, ""); return [title, content]; diff --git a/src/public/app/services/note_list_renderer.js b/src/public/app/services/note_list_renderer.js index cf5f4e673..54bbd1ef6 100644 --- a/src/public/app/services/note_list_renderer.js +++ b/src/public/app/services/note_list_renderer.js @@ -157,7 +157,7 @@ class NoteListRenderer { constructor($parent, parentNote, noteIds, showNotePath = false) { this.$noteList = $(TPL); - // note list must be added to the DOM immediatelly, otherwise some functionality scripting (canvas) won't work + // note list must be added to the DOM immediately, otherwise some functionality scripting (canvas) won't work $parent.empty(); this.parentNote = parentNote; diff --git a/src/public/app/services/server.js b/src/public/app/services/server.js index d23b1e90d..70e35e5c6 100644 --- a/src/public/app/services/server.js +++ b/src/public/app/services/server.js @@ -23,7 +23,7 @@ async function getHeaders(headers) { } if (utils.isElectron()) { - // passing it explicitely here because of the electron HTTP bypass + // passing it explicitly here because of the electron HTTP bypass allHeaders.cookie = document.cookie; } diff --git a/src/public/app/share.js b/src/public/app/share.js index f92ae09ed..03ad92515 100644 --- a/src/public/app/share.js +++ b/src/public/app/share.js @@ -1,7 +1,7 @@ /** * Fetch note with given ID from backend * - * @param noteId of the given note to be fetched. If falsy, fetches current note. + * @param noteId of the given note to be fetched. If false, fetches current note. */ async function fetchNote(noteId = null) { if (!noteId) { diff --git a/src/public/app/widgets/bulk_actions/abstract_bulk_action.js b/src/public/app/widgets/bulk_actions/abstract_bulk_action.js index 21c2860c8..6bb01d256 100644 --- a/src/public/app/widgets/bulk_actions/abstract_bulk_action.js +++ b/src/public/app/widgets/bulk_actions/abstract_bulk_action.js @@ -26,7 +26,7 @@ export default class AbstractBulkAction { } } - // to be overriden + // to be overridden doRender() {} async saveAction(data) { diff --git a/src/public/app/widgets/buttons/right_dropdown_button.js b/src/public/app/widgets/buttons/right_dropdown_button.js index 14c95acaa..d3b20a40e 100644 --- a/src/public/app/widgets/buttons/right_dropdown_button.js +++ b/src/public/app/widgets/buttons/right_dropdown_button.js @@ -50,7 +50,7 @@ export default class RightDropdownButtonWidget extends BasicWidget { this.$widget.find(".dropdown-menu").append(this.$dropdownContent); } - // to be overriden + // to be overridden async dropdownShow() {} hideDropdown() { diff --git a/src/public/app/widgets/dialogs/delete_notes.js b/src/public/app/widgets/dialogs/delete_notes.js index e7f56ae9e..a75023f81 100644 --- a/src/public/app/widgets/dialogs/delete_notes.js +++ b/src/public/app/widgets/dialogs/delete_notes.js @@ -25,7 +25,7 @@ const TPL = `
-