From 239c68a33c349d3bfa21bf5b3d875b59dd7731fb Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 14 Dec 2022 23:51:28 +0100 Subject: [PATCH] docs update --- .../backend_api/becca_entities_branch.js.html | 25 ++- docs/frontend_api/FrontendScriptApi.html | 166 ++++++++++++------ docs/frontend_api/NoteShort.html | 114 ++++++------ docs/frontend_api/entities_note_short.js.html | 19 +- docs/frontend_api/global.html | 2 +- .../services_frontend_script_api.js.html | 9 +- 6 files changed, 204 insertions(+), 131 deletions(-) diff --git a/docs/backend_api/becca_entities_branch.js.html b/docs/backend_api/becca_entities_branch.js.html index f3bfd2fd8..5644529d0 100644 --- a/docs/backend_api/becca_entities_branch.js.html +++ b/docs/backend_api/becca_entities_branch.js.html @@ -32,7 +32,7 @@ const Note = require('./note'); const AbstractEntity = require("./abstract_entity"); const sql = require("../../services/sql"); const dateUtils = require("../../services/date_utils"); -const utils = require("../../services/utils.js"); +const utils = require("../../services/utils"); const TaskContext = require("../../services/task_context"); const cls = require("../../services/cls"); const log = require("../../services/log"); @@ -147,6 +147,19 @@ class Branch extends AbstractEntity { return !(this.branchId in this.becca.branches); } + /** + * Branch is weak when its existence should not hinder deletion of its note. + * As a result, note with only weak branches should be immediately deleted. + * An example is shared or bookmarked clones - they are created automatically and exist for technical reasons, + * not as user-intended actions. From user perspective, they don't count as real clones and for the purpose + * of deletion should not act as a clone. + * + * @returns {boolean} + */ + get isWeak() { + return ['share', 'lbBookmarks'].includes(this.parentNoteId); + } + /** * Delete a branch. If this is a last note's branch, delete the note as well. * @@ -187,9 +200,13 @@ class Branch extends AbstractEntity { this.markAsDeleted(deleteId); - const notDeletedBranches = note.getParentBranches(); + const notDeletedBranches = note.getStrongParentBranches(); if (notDeletedBranches.length === 0) { + for (const weakBranch of note.getParentBranches()) { + weakBranch.markAsDeleted(deleteId); + } + for (const childBranch of note.getChildBranches()) { childBranch.deleteBranch(deleteId, taskContext); } @@ -198,9 +215,7 @@ class Branch extends AbstractEntity { log.info("Deleting note " + note.noteId); - // marking note as deleted as a signal to event handlers that the note is being deleted - // (isDeleted is being checked against becca) - delete this.becca.notes[note.noteId]; + this.becca.notes[note.noteId].isBeingDeleted = true; for (const attribute of note.getOwnedAttributes()) { attribute.markAsDeleted(deleteId); diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html index b5a58a4fb..0ccd21eac 100644 --- a/docs/frontend_api/FrontendScriptApi.html +++ b/docs/frontend_api/FrontendScriptApi.html @@ -81,7 +81,7 @@
Source:
@@ -223,7 +223,7 @@
Source:
@@ -329,7 +329,7 @@
Source:
@@ -435,7 +435,7 @@
Source:
@@ -541,7 +541,7 @@
Source:
@@ -651,7 +651,7 @@
Source:
@@ -764,7 +764,7 @@
Source:
@@ -874,7 +874,7 @@
Source:
@@ -1003,7 +1003,7 @@
Source:
@@ -1158,7 +1158,7 @@
Source:
@@ -1262,7 +1262,7 @@
Source:
@@ -1399,7 +1399,7 @@
Source:
@@ -1538,7 +1538,7 @@
Source:
@@ -1574,7 +1574,7 @@ -

bindGlobalShortcut(keyboardShortcut, handler)

+

bindGlobalShortcut(keyboardShortcut, handler, namespaceopt)

@@ -1602,6 +1602,8 @@ Type + Attributes + @@ -1627,6 +1629,14 @@ + + + + + + + + @@ -1650,6 +1660,14 @@ + + + + + + + + @@ -1657,6 +1675,40 @@ + + + + namespace + + + + + +string + + + + + + + + + <optional>
+ + + + + + + + + + + specify namespace of the handler for the cases where call for bind may be repeated. + If a handler with this ID exists, it's replaced by the new handler. + + + @@ -1694,7 +1746,7 @@
Source:
@@ -2058,7 +2110,7 @@
Source:
@@ -2191,7 +2243,7 @@
Source:
@@ -2301,7 +2353,7 @@
Source:
@@ -2407,7 +2459,7 @@
Source:
@@ -2513,7 +2565,7 @@
Source:
@@ -2623,7 +2675,7 @@
Source:
@@ -2734,7 +2786,7 @@ implementation of actual widget type.
Source:
@@ -2838,7 +2890,7 @@ implementation of actual widget type.
Source:
@@ -2946,7 +2998,7 @@ implementation of actual widget type.
Source:
@@ -3114,7 +3166,7 @@ implementation of actual widget type.
Source:
@@ -3251,7 +3303,7 @@ implementation of actual widget type.
Source:
@@ -3408,7 +3460,7 @@ implementation of actual widget type.
Source:
@@ -3563,7 +3615,7 @@ implementation of actual widget type.
Source:
@@ -3670,7 +3722,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3825,7 +3877,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3981,7 +4033,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4182,7 +4234,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4288,7 +4340,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4443,7 +4495,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4598,7 +4650,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4748,7 +4800,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4908,7 +4960,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5086,7 +5138,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5237,7 +5289,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5345,7 +5397,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5501,7 +5553,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5657,7 +5709,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5794,7 +5846,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5948,7 +6000,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -6034,7 +6086,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -6171,7 +6223,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -6332,7 +6384,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6440,7 +6492,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6578,7 +6630,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6734,7 +6786,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6889,7 +6941,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7040,7 +7092,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7177,7 +7229,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7314,7 +7366,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7474,7 +7526,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7634,7 +7686,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7726,7 +7778,7 @@ Typical use case is when new note has been created, we should wait until it is s
Source:
diff --git a/docs/frontend_api/NoteShort.html b/docs/frontend_api/NoteShort.html index 2bcc4f67c..a5a3f6060 100644 --- a/docs/frontend_api/NoteShort.html +++ b/docs/frontend_api/NoteShort.html @@ -167,7 +167,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -267,7 +267,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -335,7 +335,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -403,7 +403,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -471,7 +471,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -543,7 +543,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -611,7 +611,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -679,7 +679,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -747,7 +747,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -815,7 +815,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -883,7 +883,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -955,7 +955,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1103,7 +1103,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1281,7 +1281,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1481,7 +1481,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1589,7 +1589,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1693,7 +1693,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1795,7 +1795,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1897,7 +1897,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1999,7 +1999,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2150,7 +2150,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2305,7 +2305,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2472,7 +2472,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2582,7 +2582,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2756,7 +2756,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2934,7 +2934,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3134,7 +3134,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3289,7 +3289,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3444,7 +3444,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3611,7 +3611,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3766,7 +3766,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3921,7 +3921,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4088,7 +4088,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4194,7 +4194,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4296,7 +4296,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4398,7 +4398,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4500,7 +4500,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4651,7 +4651,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4806,7 +4806,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4976,7 +4976,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5127,7 +5127,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5294,7 +5294,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5400,7 +5400,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5513,7 +5513,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5619,7 +5619,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5721,7 +5721,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5895,7 +5895,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6001,7 +6001,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6152,7 +6152,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6330,7 +6330,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6485,7 +6485,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6640,7 +6640,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6795,7 +6795,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6903,7 +6903,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6987,7 +6987,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -7093,7 +7093,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -7199,7 +7199,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.html index abf7ce38c..85b0bad4d 100644 --- a/docs/frontend_api/entities_note_short.js.html +++ b/docs/frontend_api/entities_note_short.js.html @@ -43,14 +43,15 @@ const NOTE_TYPE_ICONS = { "code": "bx bx-code", "render": "bx bx-extension", "search": "bx bx-file-find", - "relation-map": "bx bx-map-alt", + "relationMap": "bx bx-map-alt", "book": "bx bx-book", - "note-map": "bx bx-map-alt", + "noteMap": "bx bx-map-alt", "mermaid": "bx bx-selection", "canvas": "bx bx-pen", - "web-view": "bx bx-globe-alt", - "shortcut": "bx bx-link", - "doc": "bx bxs-file-doc" + "webView": "bx bx-globe-alt", + "launcher": "bx bx-link", + "doc": "bx bxs-file-doc", + "contentWidget": "bx bxs-widget" }; /** @@ -319,7 +320,7 @@ class NoteShort { } isRoot() { - return this.noted + return this.noteId === 'root'; } getAllNotePaths(encounteredNoteIds = null) { @@ -855,7 +856,11 @@ class NoteShort { } isLaunchBarConfig() { - return this.type === 'shortcut' || this.noteId.startsWith("lb_"); + return this.type === 'launcher' || ['lbRoot', 'lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(this.noteId); + } + + isOptions() { + return this.noteId.startsWith("options"); } } diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.html index 8b0eb68af..d721331e5 100644 --- a/docs/frontend_api/global.html +++ b/docs/frontend_api/global.html @@ -395,7 +395,7 @@
Source:
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index fe85e94db..81a9e2905 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -37,10 +37,11 @@ import dateNotesService from './date_notes.js'; import searchService from './search.js'; import CollapsibleWidget from '../widgets/collapsible_widget.js'; import ws from "./ws.js"; -import appContext from "./app_context.js"; +import appContext from "../components/app_context.js"; import NoteContextAwareWidget from "../widgets/note_context_aware_widget.js"; import BasicWidget from "../widgets/basic_widget.js"; import SpacedUpdate from "./spaced_update.js"; +import shortcutService from "./shortcuts.js"; /** * This is the main frontend API interface for scripts. It's published in the local "api" object. @@ -49,8 +50,6 @@ import SpacedUpdate from "./spaced_update.js"; * @hideconstructor */ function FrontendScriptApi(startNote, currentNote, originEntity = null, $container = null) { - const $pluginButtons = $("#plugin-buttons"); - /** @property {jQuery} container of all the rendered script content */ this.$container = $container; @@ -538,8 +537,10 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain * @method * @param {string} keyboardShortcut - e.g. "ctrl+shift+a" * @param {function} handler + * @param {string} [namespace] - specify namespace of the handler for the cases where call for bind may be repeated. + * If a handler with this ID exists, it's replaced by the new handler. */ - this.bindGlobalShortcut = utils.bindGlobalShortcut; + this.bindGlobalShortcut = shortcutService.bindGlobalShortcut; /** * Trilium runs in backend and frontend process, when something is changed on the backend from script,