From d5aea26960e9166f7e388403150f18758fd58cd2 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Mon, 21 Aug 2023 04:17:16 -0400 Subject: [PATCH] Update API Docs --- docs/backend_api/AbstractBeccaEntity.html | 6 +- docs/backend_api/BAttachment.html | 2873 +++++++++++++++++ docs/backend_api/BAttribute.html | 169 +- docs/backend_api/BBranch.html | 22 +- docs/backend_api/BEtapiToken.html | 14 +- docs/backend_api/BNote.html | 252 +- docs/backend_api/BOption.html | 6 +- docs/backend_api/BRecentNote.html | 6 +- docs/backend_api/BRevision.html | 2690 +++++++++++++++ docs/backend_api/BackendScriptApi.html | 727 ++--- ...cca_entities_abstract_becca_entity.js.html | 2 +- .../becca_entities_battachment.js.html | 290 ++ .../becca_entities_battribute.js.html | 10 +- docs/backend_api/becca_entities_bblob.js.html | 81 + .../becca_entities_bbranch.js.html | 2 +- .../becca_entities_betapi_token.js.html | 2 +- docs/backend_api/becca_entities_bnote.js.html | 30 +- .../becca_entities_boption.js.html | 2 +- .../becca_entities_brecent_note.js.html | 2 +- .../becca_entities_brevision.js.html | 203 ++ docs/backend_api/global.html | 655 ++++ docs/backend_api/index.html | 2 +- docs/backend_api/module-sql.html | 2 +- .../services_backend_script_api.js.html | 107 +- docs/backend_api/services_sql.js.html | 2 +- docs/frontend_api/BasicWidget.html | 443 +++ docs/frontend_api/FAttachment.html | 1066 ++++++ docs/frontend_api/FAttribute.html | 35 +- docs/frontend_api/FBranch.html | 9 +- docs/frontend_api/FNote.html | 164 +- docs/frontend_api/FrontendScriptApi.html | 774 ++--- docs/frontend_api/NoteContextAwareWidget.html | 1029 ++++++ docs/frontend_api/RightPanelWidget.html | 1214 +++++++ .../frontend_api/entities_fattachment.js.html | 102 + docs/frontend_api/entities_fattribute.js.html | 9 +- docs/frontend_api/entities_fblob.js.html | 69 + docs/frontend_api/entities_fbranch.js.html | 2 +- docs/frontend_api/entities_fnote.js.html | 41 +- docs/frontend_api/global.html | 678 ++++ docs/frontend_api/index.html | 2 +- .../services_frontend_script_api.js.html | 66 +- .../frontend_api/widgets_basic_widget.js.html | 230 ++ .../widgets_note_context_aware_widget.js.html | 173 + .../widgets_right_panel_widget.js.html | 100 + 44 files changed, 12895 insertions(+), 1468 deletions(-) create mode 100644 docs/backend_api/BAttachment.html create mode 100644 docs/backend_api/BRevision.html create mode 100644 docs/backend_api/becca_entities_battachment.js.html create mode 100644 docs/backend_api/becca_entities_bblob.js.html create mode 100644 docs/backend_api/becca_entities_brevision.js.html create mode 100644 docs/backend_api/global.html create mode 100644 docs/frontend_api/BasicWidget.html create mode 100644 docs/frontend_api/FAttachment.html create mode 100644 docs/frontend_api/NoteContextAwareWidget.html create mode 100644 docs/frontend_api/RightPanelWidget.html create mode 100644 docs/frontend_api/entities_fattachment.js.html create mode 100644 docs/frontend_api/entities_fblob.js.html create mode 100644 docs/frontend_api/global.html create mode 100644 docs/frontend_api/widgets_basic_widget.js.html create mode 100644 docs/frontend_api/widgets_note_context_aware_widget.js.html create mode 100644 docs/frontend_api/widgets_right_panel_widget.js.html diff --git a/docs/backend_api/AbstractBeccaEntity.html b/docs/backend_api/AbstractBeccaEntity.html index 739d9d2ca..9ad79dac6 100644 --- a/docs/backend_api/AbstractBeccaEntity.html +++ b/docs/backend_api/AbstractBeccaEntity.html @@ -828,9 +828,7 @@
- Mark the entity as (soft) deleted. It will be completely erased later. - -This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. + Mark the entity as (soft) deleted. It will be completely erased later. This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead.
@@ -1174,7 +1172,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
diff --git a/docs/backend_api/BAttachment.html b/docs/backend_api/BAttachment.html new file mode 100644 index 000000000..1ab7b403f --- /dev/null +++ b/docs/backend_api/BAttachment.html @@ -0,0 +1,2873 @@ + + + + + JSDoc: Class: BAttachment + + + + + + + + + + +
+ +

Class: BAttachment

+ + + + + + +
+ +
+ +

BAttachment()

+ +
Attachment represent data related/attached to the note. Conceptually similar to attributes, but intended for larger amounts of data and generally not accessible to the user.
+ + +
+ +
+
+ + + + +

Constructor

+ + + +

new BAttachment()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Members

+ + + +

attachmentId :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(protected) becca

+ + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

blobId :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

contentLength :int

+ + + + +
+ optionally added to the entity +
+ + + +
Type:
+
    +
  • + +int + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

dateModified :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isProtected :boolean

+ + + + + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

mime :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

ownerId :string

+ + + + +
+ either noteId or revisionId to which this attachment belongs +
+ + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

position :int

+ + + + + + +
Type:
+
    +
  • + +int + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

role :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

title :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateModified :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateScheduledForErasureSince :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + + +

(protected) _getContent() → {string|Buffer}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +string +| + +Buffer + + +
+
+ + + + + + + + + + + + + +

(protected) _setContent()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

(protected) beforeSaving()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

convertToNote() → {Object}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + + + + +

copy() → {BAttachment}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +BAttachment + + +
+
+ + + + + + + + + + + + + +

(protected) generateHash()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

(protected) generateIdIfNecessary()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

getContent() → {string|Buffer}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +string +| + +Buffer + + +
+
+ + + + + + + + + + + + + +

getNote() → {BNote}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +BNote + + +
+
+ + + + + + + + + + + + + +

(protected) getPojoToSave()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

(protected) getUtcDateChanged()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

hasStringContent() → {boolean}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ true if the note has string content (not binary) +
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + + + + +

markAsDeleted(deleteIdopt)

+ + + + + + +
+ Mark the entity as (soft) deleted. It will be completely erased later. This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
deleteId + + + + <optional>
+ + + + + +
+ + null + +
+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

(protected) putEntityChange()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

save() → {this}

+ + + + + + +
+ Saves entity - executes SQL, but doesn't commit the transaction on its own +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +this + + +
+
+ + + + + + + + + + + + + +

setContent(content, optsopt)

+ + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
content + + + + + + + +
opts + + +object + + + + + + <optional>
+ + + + + +
+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
forceSave + + +object + + + + + + <optional>
+ + + + + +
+ + false + + will also save this BAttachment entity
forceFrontendReload + + +object + + + + + + <optional>
+ + + + + +
+ + false + + override frontend heuristics on when to reload, instruct to reload
+ +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/backend_api/BAttribute.html b/docs/backend_api/BAttribute.html index cc20d0db8..cc67f7642 100644 --- a/docs/backend_api/BAttribute.html +++ b/docs/backend_api/BAttribute.html @@ -30,8 +30,7 @@

BAttribute()

-
Attribute is an abstract concept which has two real uses - label (key - value pair) -and relation (representing named relationship between source and target note)
+
Attribute is an abstract concept which has two real uses - label (key - value pair) and relation (representing named relationship between source and target note)
@@ -94,7 +93,7 @@ and relation (representing named relationship between source and target note)Source:
@@ -205,7 +204,7 @@ and relation (representing named relationship between source and target note)Source:
@@ -336,7 +335,7 @@ and relation (representing named relationship between source and target note)Source:
@@ -404,7 +403,7 @@ and relation (representing named relationship between source and target note)Source:
@@ -464,74 +463,6 @@ and relation (representing named relationship between source and target note)Source: -
- - - - - - - - - - - - - - - - -

position :int

- - - - - - -
Type:
- - - - - - -
- - - - - - - - - - - - - - - - - - - - @@ -558,7 +489,7 @@ and relation (representing named relationship between source and target note)type :string +

position :int

@@ -569,7 +500,7 @@ and relation (representing named relationship between source and target note)
  • -string +int
  • @@ -608,7 +539,75 @@ and relation (representing named relationship between source and target note)Source:
    + + + + + + + +
    + + + + + + + + +

    type :AttributeType

    + + + + + + +
    Type:
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -676,7 +675,7 @@ and relation (representing named relationship between source and target note)Source:
    @@ -744,7 +743,7 @@ and relation (representing named relationship between source and target note)Source:
    @@ -1286,7 +1285,7 @@ and relation (representing named relationship between source and target note)Source:
    @@ -1480,7 +1479,7 @@ and relation (representing named relationship between source and target note)Source:
    @@ -1674,7 +1673,7 @@ and relation (representing named relationship between source and target note)Source:
    @@ -1736,9 +1735,7 @@ and relation (representing named relationship between source and target note) - Mark the entity as (soft) deleted. It will be completely erased later. - -This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. + Mark the entity as (soft) deleted. It will be completely erased later. This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. @@ -2097,7 +2094,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
    diff --git a/docs/backend_api/BBranch.html b/docs/backend_api/BBranch.html index 4e716ec2e..b1ad91429 100644 --- a/docs/backend_api/BBranch.html +++ b/docs/backend_api/BBranch.html @@ -30,11 +30,7 @@

    BBranch()

    -
    Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple -parents. - -Note that you should not rely on the branch's identity, since it can change easily with a note's move. -Always check noteId instead.
    +
    Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple parents. Note that you should not rely on the branch's identity, since it can change easily with a note's move. Always check noteId instead.
    @@ -421,11 +417,7 @@ Always check noteId instead.
    - 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. + 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.
    @@ -549,7 +541,7 @@ of deletion should not act as a clone. -

    notePosition :int

    +

    notePosition :int

    @@ -560,7 +552,7 @@ of deletion should not act as a clone.
    @@ -852,68 +630,30 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s -

    originEntity

    +

    originEntity :object|null

    +
    + Entity whose event triggered this execution +
    - - - -
    Properties:
    - - - - - - - - - - - - - - - - - - - - - - - - +
    Type:
    +
      +
    • -
    - - - + + - - - - - - - - - -
    NameTypeDescription
    entity - - object | null - - whose event triggered this execution
    @@ -947,7 +687,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -965,65 +705,27 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s -

    startNote

    +

    startNote :FNote

    +
    + Note where the script started executing +
    - - - -
    Properties:
    - - - - - - - - - - - - - - - - - - - - - - - - +
    Type:
    +
      +
    • -
    - - - + + - - - - - - - - - -
    NameTypeDescription
    note - - -object +FNote - - where the script started executing
    @@ -1057,7 +759,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -1186,7 +888,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -1341,7 +1043,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -1455,23 +1157,11 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s - - + +
    Properties
    + - - - - - - - - - -
    Properties:
    - - - - +
    @@ -1495,7 +1185,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s - + - - - - - - - - - - - - - - - - - - @@ -1556,38 +1216,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s - - - - - - - - - - - - - - - - - - - + @@ -1616,7 +1247,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1647,6 +1346,15 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    opts.idtitle @@ -1510,38 +1200,8 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s - <optional>
    - -
    id of the button, used to identify the old instances of this button to be replaced - ID is optional because of BC, but not specifying it is deprecated. ID can be alphanumeric only.
    opts.title - - -string - - - - -
    opts.icon - - -string - - - - - - <optional>
    - - - -
    name of the boxicon to be used (e.g. "time" for "bx-time" icon)
    opts.actionaction @@ -1604,6 +1233,8 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s + +
    opts.shortcutid @@ -1635,6 +1266,74 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s + + + id of the button, used to identify the old instances of this button to be replaced ID is optional because of BC, but not specifying it is deprecated. ID can be alphanumeric only.
    icon + + +string + + + + + + <optional>
    + + + + + +
    name of the boxicon to be used (e.g. "time" for "bx-time" icon)
    shortcut + + +string + + + + + + <optional>
    + + + + +
    + + + + + + + + + @@ -1667,8 +1375,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s -
    Deprecated:
    • you can now create/modify launchers in the top-left Menu -> Configure Launchbar - for special needs there's also backend API's createOrUpdateLauncher()
    +
    Deprecated:
    • you can now create/modify launchers in the top-left Menu -> Configure Launchbar for special needs there's also backend API's createOrUpdateLauncher()
    @@ -1682,7 +1389,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -1819,7 +1526,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -1985,8 +1692,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s - 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. + 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. @@ -2027,7 +1733,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -2331,7 +2037,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s - title= + title @@ -2409,7 +2115,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -2542,7 +2248,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -2646,7 +2352,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s -int +int @@ -2699,7 +2405,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -2803,7 +2509,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s -int +int @@ -2854,7 +2560,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -2964,7 +2670,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -3070,7 +2776,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -3176,7 +2882,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -3286,7 +2992,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    Source:
    @@ -3352,8 +3058,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
    - Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the -implementation of actual widget type. + Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the implementation of actual widget type.
    @@ -3397,7 +3102,7 @@ implementation of actual widget type.
    Source:
    @@ -3552,7 +3257,7 @@ implementation of actual widget type.
    Source:
    @@ -3707,7 +3412,7 @@ implementation of actual widget type.
    Source:
    @@ -3769,8 +3474,7 @@ implementation of actual widget type.
    - Instance name identifies particular Trilium instance. It can be useful for scripts -if some action needs to happen on only one specific instance. + Instance name identifies particular Trilium instance. It can be useful for scripts if some action needs to happen on only one specific instance.
    @@ -3814,7 +3518,7 @@ if some action needs to happen on only one specific instance.
    Source:
    @@ -3969,7 +3673,7 @@ if some action needs to happen on only one specific instance.
    Source:
    @@ -4031,8 +3735,7 @@ if some action needs to happen on only one specific instance.
    - Returns note by given noteId. If note is missing from the cache, it's loaded. -* + Returns note by given noteId. If note is missing from the cache, it's loaded. *
    @@ -4125,7 +3828,7 @@ if some action needs to happen on only one specific instance.
    Source:
    @@ -4187,10 +3890,7 @@ if some action needs to happen on only one specific instance.
    - Returns list of notes. If note is missing from the cache, it's loaded. - -This is often used to bulk-fill the cache with notes which would have to be picked one by one -otherwise (by e.g. createLink()) + Returns list of notes. If note is missing from the cache, it's loaded. This is often used to bulk-fill the cache with notes which would have to be picked one by one otherwise (by e.g. createLink())
    @@ -4326,7 +4026,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -4432,7 +4132,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -4587,7 +4287,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -4742,7 +4442,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -4892,7 +4592,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -5070,7 +4770,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -5248,7 +4948,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -5399,7 +5099,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -5577,7 +5277,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -5751,7 +5451,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -5855,7 +5555,7 @@ otherwise (by e.g. createLink()) -int +int @@ -5906,7 +5606,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -6060,7 +5760,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -6215,7 +5915,7 @@ otherwise (by e.g. createLink())
    Source:
    @@ -6251,7 +5951,7 @@ otherwise (by e.g. createLink()) -

    runOnBackend(script, params) → {Promise.<*>}

    +

    runOnBackend(script, params) → {Promise.<any>}

    @@ -6259,8 +5959,7 @@ otherwise (by e.g. createLink())
    - Executes given anonymous function on the backend. -Internally this serializes the anonymous function into string and sends it to backend via AJAX. + Executes given anonymous function on the backend. Internally this serializes the anonymous function into string and sends it to backend via AJAX.
    @@ -6303,6 +6002,9 @@ Internally this serializes the anonymous function into string and sends it to ba string +| + +function @@ -6325,7 +6027,7 @@ Internally this serializes the anonymous function into string and sends it to ba -Array.<?> +Array.<any> @@ -6376,7 +6078,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -6416,7 +6118,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    -Promise.<*> +Promise.<any>
    @@ -6442,8 +6144,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    - This is a powerful search method - you can search by attributes and their values, e.g.: -"#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search + This is a powerful search method - you can search by attributes and their values, e.g.: "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
    @@ -6536,7 +6237,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -6598,8 +6299,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    - This is a powerful search method - you can search by attributes and their values, e.g.: -"#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search + This is a powerful search method - you can search by attributes and their values, e.g.: "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
    @@ -6692,7 +6392,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -6847,7 +6547,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -6998,7 +6698,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -7153,7 +6853,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -7290,7 +6990,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -7450,7 +7150,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -7610,7 +7310,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    Source:
    @@ -7654,11 +7354,7 @@ Internally this serializes the anonymous function into string and sends it to ba
    - Trilium runs in a backend and frontend process, when something is changed on the backend from a script, -frontend will get asynchronously synchronized. - -This method returns a promise which resolves once all the backend -> frontend synchronization is finished. -Typical use case is when a new note has been created, we should wait until it is synced into frontend and only then activate it. + Trilium runs in a backend and frontend process, when something is changed on the backend from a script, frontend will get asynchronously synchronized. This method returns a promise which resolves once all the backend -> frontend synchronization is finished. Typical use case is when a new note has been created, we should wait until it is synced into frontend and only then activate it.
    @@ -7702,7 +7398,7 @@ Typical use case is when a new note has been created, we should wait until it is
    Source:
    @@ -7766,7 +7462,7 @@ Typical use case is when a new note has been created, we should wait until it is
    diff --git a/docs/frontend_api/NoteContextAwareWidget.html b/docs/frontend_api/NoteContextAwareWidget.html new file mode 100644 index 000000000..32692483d --- /dev/null +++ b/docs/frontend_api/NoteContextAwareWidget.html @@ -0,0 +1,1029 @@ + + + + + JSDoc: Class: NoteContextAwareWidget + + + + + + + + + + +
    + +

    Class: NoteContextAwareWidget

    + + + + + + +
    + +
    + +

    NoteContextAwareWidget()

    + +
    This widget allows for changing and updating depending on the active note.
    + + +
    + +
    +
    + + + + +

    Constructor

    + + + +

    new NoteContextAwareWidget()

    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + +
    + + +

    Extends

    + + + + + + + + + + + + + + + + + + + + +

    Members

    + + + +

    hoistedNoteId

    + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    note

    + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    noteContext :NoteContext

    + + + + + + +
    Type:
    +
      +
    • + +NoteContext + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    noteId

    + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    notePath

    + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + +

    Methods

    + + + + + + + +

    cssBlock(block) → {this}

    + + + + + + +
    + Accepts a string of CSS to add with the widget. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    block + + +string + + + +
    + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + for chaining +
    + + + +
    +
    + Type +
    +
    + +this + + +
    +
    + + + + + + + + + + + + + +

    doRender() → {JQuery.<HTMLElement>}

    + + + + + + +
    + Method used for rendering the widget. Your class should override this method. +
    + + + + + + + + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + Your widget. +
    + + + +
    +
    + Type +
    +
    + +JQuery.<HTMLElement> + + +
    +
    + + + + + + + + + + + + + +

    isEnabled() → {boolean}

    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + true when an active note exists +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + + + + + + + + + +

    (async) refreshWithNote(note) → {Promise.<void>}

    + + + + + + +
    + Override this method to be able to refresh your widget with each note. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    note + + +FNote + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +Promise.<void> + + +
    +
    + + + + + + + + + + + + + +
    + +
    + + + + +
    + + + +
    + + + + + + + \ No newline at end of file diff --git a/docs/frontend_api/RightPanelWidget.html b/docs/frontend_api/RightPanelWidget.html new file mode 100644 index 000000000..eaa462670 --- /dev/null +++ b/docs/frontend_api/RightPanelWidget.html @@ -0,0 +1,1214 @@ + + + + + JSDoc: Class: RightPanelWidget + + + + + + + + + + +
    + +

    Class: RightPanelWidget

    + + + + + + +
    + +
    + +

    RightPanelWidget()

    + +
    This widget manages rendering panels in the right-hand pane.
    + + +
    + +
    +
    + + + + +

    Constructor

    + + + +

    new RightPanelWidget()

    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + +
    + + +

    Extends

    + + + + + + + + + + + + + + + + + + + + +

    Members

    + + + +

    hoistedNoteId

    + + + + + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    note

    + + + + + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    noteContext :NoteContext

    + + + + + + +
    Type:
    +
      +
    • + +NoteContext + + +
    • +
    + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    noteId

    + + + + + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    notePath

    + + + + + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    widgetTitle

    + + + + +
    + Title to show in the panel. +
    + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + +

    Methods

    + + + + + + + +

    cssBlock(block) → {this}

    + + + + + + +
    + Accepts a string of CSS to add with the widget. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    block + + +string + + + +
    + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + for chaining +
    + + + +
    +
    + Type +
    +
    + +this + + +
    +
    + + + + + + + + + + + + + +

    doRender()

    + + + + + + +
    + Do not override this method unless you know what you're doing. +
    + + + + + + + + + + + + + +
    + + + + + + + + +
    Overrides:
    +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +

    (async) doRenderBody() → {JQuery.<HTMLElement>}

    + + + + + + +
    + Method used for rendering the body of the widget. Your class should override this method. +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + The body of your widget. +
    + + + +
    +
    + Type +
    +
    + +JQuery.<HTMLElement> + + +
    +
    + + + + + + + + + + + + + +

    isEnabled() → {boolean}

    + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + true when an active note exists +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + + + + + + + + + +

    (async) refreshWithNote(note) → {Promise.<void>}

    + + + + + + +
    + Override this method to be able to refresh your widget with each note. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    note + + +FNote + + + +
    + + + + + + +
    + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +Promise.<void> + + +
    +
    + + + + + + + + + + + + + +
    + +
    + + + + +
    + + + +
    + + + + + + + \ No newline at end of file diff --git a/docs/frontend_api/entities_fattachment.js.html b/docs/frontend_api/entities_fattachment.js.html new file mode 100644 index 000000000..5397b6a38 --- /dev/null +++ b/docs/frontend_api/entities_fattachment.js.html @@ -0,0 +1,102 @@ + + + + + JSDoc: Source: entities/fattachment.js + + + + + + + + + + +
    + +

    Source: entities/fattachment.js

    + + + + + + +
    +
    +
    /**
    + * Attachment is a file directly tied into a note without
    + * being a hidden child.
    + */
    +class FAttachment {
    +    constructor(froca, row) {
    +        /** @type {Froca} */
    +        this.froca = froca;
    +
    +        this.update(row);
    +    }
    +
    +    update(row) {
    +        /** @type {string} */
    +        this.attachmentId = row.attachmentId;
    +        /** @type {string} */
    +        this.ownerId = row.ownerId;
    +        /** @type {string} */
    +        this.role = row.role;
    +        /** @type {string} */
    +        this.mime = row.mime;
    +        /** @type {string} */
    +        this.title = row.title;
    +        /** @type {string} */
    +        this.dateModified = row.dateModified;
    +        /** @type {string} */
    +        this.utcDateModified = row.utcDateModified;
    +        /** @type {string} */
    +        this.utcDateScheduledForErasureSince = row.utcDateScheduledForErasureSince;
    +
    +        /**
    +         * optionally added to the entity 
    +         * @type {int}
    +         */
    +        this.contentLength = row.contentLength;
    +
    +        this.froca.attachments[this.attachmentId] = this;
    +    }
    +
    +    /** @returns {FNote} */
    +    getNote() {
    +        return this.froca.notes[this.ownerId];
    +    }
    +
    +    /** @return {FBlob} */
    +    async getBlob() {
    +        return await this.froca.getBlob('attachments', this.attachmentId);
    +    }
    +}
    +
    +export default FAttachment;
    +
    +
    +
    + + + + +
    + + + +
    + + + + + + + diff --git a/docs/frontend_api/entities_fattribute.js.html b/docs/frontend_api/entities_fattribute.js.html index abbb8b686..00da37ca1 100644 --- a/docs/frontend_api/entities_fattribute.js.html +++ b/docs/frontend_api/entities_fattribute.js.html @@ -28,6 +28,11 @@
    import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js';
     
    +/**
    + * There are currently only two types of attributes, labels or relations.
    + * @typedef {"label" | "relation"} AttributeType
    + */
    +
     /**
      * Attribute is an abstract concept which has two real uses - label (key - value pair)
      * and relation (representing named relationship between source and target note)
    @@ -45,7 +50,7 @@ class FAttribute {
             this.attributeId = row.attributeId;
             /** @type {string} */
             this.noteId = row.noteId;
    -        /** @type {string} */
    +        /** @type {AttributeType} */
             this.type = row.type;
             /** @type {string} */
             this.name = row.name;
    @@ -116,7 +121,7 @@ export default FAttribute;
     
     
     
     
     
    diff --git a/docs/frontend_api/entities_fblob.js.html b/docs/frontend_api/entities_fblob.js.html new file mode 100644 index 000000000..811119774 --- /dev/null +++ b/docs/frontend_api/entities_fblob.js.html @@ -0,0 +1,69 @@ + + + + + JSDoc: Source: entities/fblob.js + + + + + + + + + + +
    + +

    Source: entities/fblob.js

    + + + + + + +
    +
    +
    export default class FBlob {
    +    constructor(row) {
    +        /** @type {string} */
    +        this.blobId = row.blobId;
    +
    +        /**
    +         * can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
    +         * @type {string}
    +         */
    +        this.content = row.content;
    +        this.contentLength = row.contentLength;
    +
    +        /** @type {string} */
    +        this.dateModified = row.dateModified;
    +        /** @type {string} */
    +        this.utcDateModified = row.utcDateModified;
    +    }
    +}
    +
    +
    +
    + + + + +
    + + + +
    + + + + + + + diff --git a/docs/frontend_api/entities_fbranch.js.html b/docs/frontend_api/entities_fbranch.js.html index 1d663d7de..95ef4d084 100644 --- a/docs/frontend_api/entities_fbranch.js.html +++ b/docs/frontend_api/entities_fbranch.js.html @@ -100,7 +100,7 @@ export default FBranch;
    diff --git a/docs/frontend_api/entities_fnote.js.html b/docs/frontend_api/entities_fnote.js.html index 99231fa38..5fefcb779 100644 --- a/docs/frontend_api/entities_fnote.js.html +++ b/docs/frontend_api/entities_fnote.js.html @@ -53,6 +53,25 @@ const NOTE_TYPE_ICONS = { "contentWidget": "bx bxs-widget" }; +/** + * There are many different Note types, some of which are entirely opaque to the + * end user. Those types should be used only for checking against, they are + * not for direct use. + * @typedef {"file" | "image" | "search" | "noteMap" | "launcher" | "doc" | "contentWidget" | "text" | "relationMap" | "render" | "canvas" | "mermaid" | "book" | "webView" | "code"} NoteType + */ + +/** + * @typedef {Object} NotePathRecord + * @property {boolean} isArchived + * @property {boolean} isInHoistedSubTree + * @property {boolean} isSearch + * @property {Array<string>} notePath + * @property {boolean} isHidden + */ + +/** + * Note is the main node and concept in Trilium. + */ class FNote { /** * @param {Froca} froca @@ -93,8 +112,8 @@ class FNote { /** @type {boolean} */ this.isProtected = !!row.isProtected; /** - * one of 'text', 'code', 'file' or 'render' - * @type {string} + * See {@see NoteType} for info on values. + * @type {NoteType} */ this.type = row.type; /** @@ -399,7 +418,7 @@ class FNote { /** * @param {string} [hoistedNoteId='root'] - * @return {Array<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, notePath: Array<string>, isHidden: boolean}>} + * @return {Array<NotePathRecord>} */ getSortedNotePathRecords(hoistedNoteId = 'root') { const isHoistedRoot = hoistedNoteId === 'root'; @@ -478,7 +497,7 @@ class FNote { /** * @param {FAttribute[]} attributes - * @param {string} type + * @param {AttributeType} type * @param {string} name * @return {FAttribute[]} * @private @@ -607,7 +626,7 @@ class FNote { } /** - * @param {string} type - attribute type (label, relation, etc.) + * @param {AttributeType} type - attribute type (label, relation, etc.) * @param {string} name - attribute name * @returns {boolean} true if note has an attribute with given type and name (including inherited) */ @@ -618,7 +637,7 @@ class FNote { } /** - * @param {string} type - attribute type (label, relation, etc.) + * @param {AttributeType} type - attribute type (label, relation, etc.) * @param {string} name - attribute name * @returns {boolean} true if note has an attribute with given type and name (including inherited) */ @@ -627,7 +646,7 @@ class FNote { } /** - * @param {string} type - attribute type (label, relation, etc.) + * @param {AttributeType} 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. */ @@ -638,7 +657,7 @@ class FNote { } /** - * @param {string} type - attribute type (label, relation, etc.) + * @param {AttributeType} 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. */ @@ -649,7 +668,7 @@ class FNote { } /** - * @param {string} type - attribute type (label, relation, etc.) + * @param {AttributeType} type - attribute type (label, relation, etc.) * @param {string} name - attribute name * @returns {string} attribute value of the given type and name or null if no such attribute exists. */ @@ -660,7 +679,7 @@ class FNote { } /** - * @param {string} type - attribute type (label, relation, etc.) + * @param {AttributeType} type - attribute type (label, relation, etc.) * @param {string} name - attribute name * @returns {string} attribute value of the given type and name or null if no such attribute exists. */ @@ -1012,7 +1031,7 @@ export default FNote;
    diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.html new file mode 100644 index 000000000..6d15487aa --- /dev/null +++ b/docs/frontend_api/global.html @@ -0,0 +1,678 @@ + + + + + JSDoc: Global + + + + + + + + + + +
    + +

    Global

    + + + + + + +
    + +
    + +

    + + +
    + +
    +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + + + + + + + + + +

    Members

    + + + +

    api :FrontendScriptApi

    + + + + +
    + An instance of the frontend api available globally. +
    + + + +
    Type:
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + +

    Type Definitions

    + + + +

    AttributeType

    + + + + +
    + There are currently only two types of attributes, labels or relations. +
    + + + +
    Type:
    +
      +
    • + +"label" +| + +"relation" + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    NotePathRecord

    + + + + + + +
    Type:
    +
      +
    • + +Object + + +
    • +
    + + + + + +
    Properties:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isArchived + + +boolean + + + +
    isInHoistedSubTree + + +boolean + + + +
    isSearch + + +boolean + + + +
    notePath + + +Array.<string> + + + +
    isHidden + + +boolean + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    NoteType

    + + + + +
    + There are many different Note types, some of which are entirely opaque to the end user. Those types should be used only for checking against, they are not for direct use. +
    + + + +
    Type:
    +
      +
    • + +"file" +| + +"image" +| + +"search" +| + +"noteMap" +| + +"launcher" +| + +"doc" +| + +"contentWidget" +| + +"text" +| + +"relationMap" +| + +"render" +| + +"canvas" +| + +"mermaid" +| + +"book" +| + +"webView" +| + +"code" + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + +

    int

    + + + + +
    + A whole number +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + +
    + +
    + + + + +
    + + + +
    + + + + + + + \ No newline at end of file diff --git a/docs/frontend_api/index.html b/docs/frontend_api/index.html index 46ccdc9a8..1c6319630 100644 --- a/docs/frontend_api/index.html +++ b/docs/frontend_api/index.html @@ -50,7 +50,7 @@
    diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index 3540460c6..7780bc7a5 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -43,6 +43,18 @@ import BasicWidget from "../widgets/basic_widget.js"; import SpacedUpdate from "./spaced_update.js"; import shortcutService from "./shortcuts.js"; + +/** + * A whole number + * @typedef {number} int + */ + +/** + * An instance of the frontend api available globally. + * @global + * @var {FrontendScriptApi} api + */ + /** * <p>This is the main frontend API interface for scripts. All the properties and methods are published in the "api" object * available in the JS frontend notes. You can use e.g. <code>api.showMessage(api.startNote.title);</code></p> @@ -50,26 +62,44 @@ import shortcutService from "./shortcuts.js"; * @constructor */ function FrontendScriptApi(startNote, currentNote, originEntity = null, $container = null) { - /** @property {jQuery} container of all the rendered script content */ + /** + * Container of all the rendered script content + * @type {jQuery} + * */ this.$container = $container; - /** @property {object} note where the script started executing */ + /** + * Note where the script started executing + * @type {FNote} + */ this.startNote = startNote; - /** @property {object} note where the script is currently executing */ + + /** + * Note where the script is currently executing + * @type {FNote} + */ this.currentNote = currentNote; - /** @property {object|null} entity whose event triggered this execution */ + /** + * Entity whose event triggered this execution + * @type {object|null} + */ this.originEntity = originEntity; - /** @property {dayjs} day.js library for date manipulation. See {@link https://day.js.org} for documentation */ + /** + * day.js library for date manipulation. + * See {@link https://day.js.org} for documentation + * @see https://day.js.org + * @type {dayjs} + */ this.dayjs = dayjs; - /** @property {RightPanelWidget} */ + /** @type {RightPanelWidget} */ this.RightPanelWidget = RightPanelWidget; - /** @property {NoteContextAwareWidget} */ + /** @type {NoteContextAwareWidget} */ this.NoteContextAwareWidget = NoteContextAwareWidget; - /** @property {BasicWidget} */ + /** @type {BasicWidget} */ this.BasicWidget = BasicWidget; /** @@ -142,12 +172,12 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain * @deprecated you can now create/modify launchers in the top-left Menu -> Configure Launchbar * for special needs there's also backend API's createOrUpdateLauncher() * @param {object} opts - * @property {string} [opts.id] - id of the button, used to identify the old instances of this button to be replaced + * @param {string} opts.title + * @param {function} opts.action - callback handling the click on the button + * @param {string} [opts.id] - id of the button, used to identify the old instances of this button to be replaced * ID is optional because of BC, but not specifying it is deprecated. ID can be alphanumeric only. - * @property {string} opts.title - * @property {string} [opts.icon] - name of the boxicon to be used (e.g. "time" for "bx-time" icon) - * @property {function} opts.action - callback handling the click on the button - * @property {string} [opts.shortcut] - keyboard shortcut for the button, e.g. "alt+t" + * @param {string} [opts.icon] - name of the boxicon to be used (e.g. "time" for "bx-time" icon) + * @param {string} [opts.shortcut] - keyboard shortcut for the button, e.g. "alt+t" */ this.addButtonToToolbar = async opts => { console.warn("api.addButtonToToolbar() has been deprecated since v0.58 and may be removed in the future. Use Menu -> Configure Launchbar to create/update launchers instead."); @@ -178,9 +208,9 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain * Internally this serializes the anonymous function into string and sends it to backend via AJAX. * * @method - * @param {string} script - script to be executed on the backend - * @param {Array.<?>} params - list of parameters to the anonymous function to be sent to backend - * @returns {Promise<*>} return value of the executed function on the backend + * @param {string|Function} script - script to be executed on the backend + * @param {Array<any>} params - list of parameters to the anonymous function to be sent to backend + * @returns {Promise<any>} return value of the executed function on the backend */ this.runOnBackend = async (script, params = []) => { if (typeof script === "function") { @@ -328,7 +358,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain * @param {boolean} [params.showTooltip=true] - enable/disable tooltip on the link * @param {boolean} [params.showNotePath=false] - show also whole note's path as part of the link * @param {boolean} [params.showNoteIcon=false] - show also note icon before the title - * @param {string} [params.title=] - custom link tile with note's title as default + * @param {string} [params.title] - custom link tile with note's title as default */ this.createLink = linkService.createLink; @@ -569,7 +599,7 @@ export default FrontendScriptApi;
    diff --git a/docs/frontend_api/widgets_basic_widget.js.html b/docs/frontend_api/widgets_basic_widget.js.html new file mode 100644 index 000000000..01c2dc537 --- /dev/null +++ b/docs/frontend_api/widgets_basic_widget.js.html @@ -0,0 +1,230 @@ + + + + + JSDoc: Source: widgets/basic_widget.js + + + + + + + + + + +
    + +

    Source: widgets/basic_widget.js

    + + + + + + +
    +
    +
    import Component from "../components/component.js";
    +
    +
    +/**
    + * This is the base widget for all other widgets.
    + * 
    + * For information on using widgets, see the tutorial {@tutorial widget_basics}.
    + */
    +class BasicWidget extends Component {
    +    constructor() {
    +        super();
    +
    +        this.attrs = {
    +            style: ''
    +        };
    +        this.classes = [];
    +
    +        this.children = [];
    +        this.childPositionCounter = 10;
    +    }
    +
    +    child(...components) {
    +        if (!components) {
    +            return this;
    +        }
    +
    +        super.child(...components);
    +
    +        for (const component of components) {
    +            if (component.position === undefined) {
    +                component.position = this.childPositionCounter;
    +                this.childPositionCounter += 10;
    +            }
    +        }
    +
    +        this.children.sort((a, b) => a.position - b.position < 0 ? -1 : 1);
    +
    +        return this;
    +    }
    +
    +    id(id) {
    +        this.attrs.id = id;
    +        return this;
    +    }
    +
    +    class(className) {
    +        this.classes.push(className);
    +        return this;
    +    }
    +
    +    css(name, value) {
    +        this.attrs.style += `${name}: ${value};`;
    +        return this;
    +    }
    +
    +    contentSized() {
    +        this.css("contain", "none");
    +
    +        return this;
    +    }
    +
    +    collapsible() {
    +        this.css('min-height', '0');
    +        this.css('min-width', '0');
    +        return this;
    +    }
    +
    +    filling() {
    +        this.css('flex-grow', '1');
    +        return this;
    +    }
    +
    +    /**
    +     * Accepts a string of CSS to add with the widget.
    +     * @param {string} block 
    +     * @returns {this} for chaining
    +     */
    +    cssBlock(block) {
    +        this.cssEl = block;
    +        return this;
    +    }
    +
    +    render() {
    +        this.doRender();
    +
    +        this.$widget.attr('data-component-id', this.componentId);
    +        this.$widget.addClass('component')
    +            .prop('component', this);
    +
    +        if (!this.isEnabled()) {
    +            this.toggleInt(false);
    +        }
    +
    +        if (this.cssEl) {
    +            const css = this.cssEl.trim().startsWith('<style>') ? this.cssEl : `<style>${this.cssEl}</style>`;
    +
    +            this.$widget.append(css);
    +        }
    +
    +        for (const key in this.attrs) {
    +            if (key === 'style') {
    +                if (this.attrs[key]) {
    +                    let style = this.$widget.attr('style');
    +                    style = style ? `${style}; ${this.attrs[key]}` : this.attrs[key];
    +
    +                    this.$widget.attr(key, style);
    +                }
    +            }
    +            else {
    +                this.$widget.attr(key, this.attrs[key]);
    +            }
    +        }
    +
    +        for (const className of this.classes) {
    +            this.$widget.addClass(className);
    +        }
    +
    +        return this.$widget;
    +    }
    +
    +    isEnabled() {
    +        return true;
    +    }
    +
    +    /**
    +     * Method used for rendering the widget.
    +     * 
    +     * Your class should override this method.
    +     * @returns {JQuery<HTMLElement>} Your widget.
    +     */
    +    doRender() {}
    +
    +    toggleInt(show) {
    +        this.$widget.toggleClass('hidden-int', !show);
    +    }
    +
    +    isHiddenInt() {
    +        return this.$widget.hasClass('hidden-int');
    +    }
    +
    +    toggleExt(show) {
    +        this.$widget.toggleClass('hidden-ext', !show);
    +    }
    +
    +    isHiddenExt() {
    +        return this.$widget.hasClass('hidden-ext');
    +    }
    +
    +    canBeShown() {
    +        return !this.isHiddenInt() && !this.isHiddenExt();
    +    }
    +
    +    isVisible() {
    +        return this.$widget.is(":visible");
    +    }
    +
    +    getPosition() {
    +        return this.position;
    +    }
    +
    +    remove() {
    +        if (this.$widget) {
    +            this.$widget.remove();
    +        }
    +    }
    +
    +    getClosestNtxId() {
    +        if (this.$widget) {
    +            return this.$widget.closest("[data-ntx-id]").attr("data-ntx-id");
    +        }
    +        else {
    +            return null;
    +        }
    +    }
    +
    +    cleanup() {}
    +}
    +
    +export default BasicWidget;
    +
    +
    +
    + + + + +
    + + + +
    + + + + + + + diff --git a/docs/frontend_api/widgets_note_context_aware_widget.js.html b/docs/frontend_api/widgets_note_context_aware_widget.js.html new file mode 100644 index 000000000..835692b26 --- /dev/null +++ b/docs/frontend_api/widgets_note_context_aware_widget.js.html @@ -0,0 +1,173 @@ + + + + + JSDoc: Source: widgets/note_context_aware_widget.js + + + + + + + + + + +
    + +

    Source: widgets/note_context_aware_widget.js

    + + + + + + +
    +
    +
    import BasicWidget from "./basic_widget.js";
    +import appContext from "../components/app_context.js";
    +
    +/**
    + * This widget allows for changing and updating depending on the active note.
    + * @extends {BasicWidget}
    + */
    +class NoteContextAwareWidget extends BasicWidget {
    +    isNoteContext(ntxId) {
    +        if (Array.isArray(ntxId)) {
    +            return this.noteContext && ntxId.includes(this.noteContext.ntxId);
    +        }
    +        else {
    +            return this.noteContext && this.noteContext.ntxId === ntxId;
    +        }
    +    }
    +
    +    isActiveNoteContext() {
    +        return appContext.tabManager.getActiveContext() === this.noteContext;
    +    }
    +
    +    isNote(noteId) {
    +        return this.noteId === noteId;
    +    }
    +
    +    /** @returns {FNote|undefined} */
    +    get note() {
    +        return this.noteContext?.note;
    +    }
    +
    +    /** @returns {string|undefined} */
    +    get noteId() {
    +        return this.note?.noteId;
    +    }
    +
    +    /** @returns {string|undefined} */
    +    get notePath() {
    +        return this.noteContext?.notePath;
    +    }
    +
    +    /** @returns {string} */
    +    get hoistedNoteId() {
    +        return this.noteContext?.hoistedNoteId;
    +    }
    +
    +    get ntxId() {
    +        return this.noteContext?.ntxId;
    +    }
    +
    +    /**
    +     * @returns {boolean} true when an active note exists
    +     */
    +    isEnabled() {
    +        return !!this.note;
    +    }
    +
    +    async refresh() {
    +        if (this.isEnabled()) {
    +            this.toggleInt(true);
    +            await this.refreshWithNote(this.note);
    +        }
    +        else {
    +            this.toggleInt(false);
    +        }
    +    }
    +
    +    /**
    +     * Override this method to be able to refresh your
    +     * widget with each note.
    +     * @param {FNote} note
    +     * @returns {Promise<void>}
    +     */
    +    async refreshWithNote(note) {}
    +
    +    async noteSwitchedEvent({noteContext, notePath}) {
    +        // if notePath does not match, then the noteContext has been switched to another note in the meantime
    +        if (noteContext.notePath === notePath) {
    +            await this.noteSwitched();
    +        }
    +    }
    +
    +    async noteSwitched() {
    +        await this.refresh();
    +    }
    +
    +    async activeContextChangedEvent({noteContext}) {
    +        this.noteContext = noteContext;
    +
    +        await this.activeContextChanged();
    +    }
    +
    +    async activeContextChanged() {
    +        await this.refresh();
    +    }
    +
    +    // when note is both switched and activated, this should not produce a double refresh
    +    async noteSwitchedAndActivatedEvent({noteContext, notePath}) {
    +        this.noteContext = noteContext;
    +
    +        // if notePath does not match, then the noteContext has been switched to another note in the meantime
    +        if (this.notePath === notePath) {
    +            await this.refresh();
    +        }
    +    }
    +
    +    setNoteContextEvent({noteContext}) {
    +        /** @var {NoteContext} */
    +        this.noteContext = noteContext;
    +    }
    +
    +    async noteTypeMimeChangedEvent({noteId}) {
    +        if (this.isNote(noteId)) {
    +            await this.refresh();
    +        }
    +    }
    +
    +    async frocaReloadedEvent() {
    +        await this.refresh();
    +    }
    +}
    +
    +export default NoteContextAwareWidget;
    +
    +
    +
    + + + + +
    + + + +
    + + + + + + + diff --git a/docs/frontend_api/widgets_right_panel_widget.js.html b/docs/frontend_api/widgets_right_panel_widget.js.html new file mode 100644 index 000000000..25644d903 --- /dev/null +++ b/docs/frontend_api/widgets_right_panel_widget.js.html @@ -0,0 +1,100 @@ + + + + + JSDoc: Source: widgets/right_panel_widget.js + + + + + + + + + + +
    + +

    Source: widgets/right_panel_widget.js

    + + + + + + +
    +
    +
    import NoteContextAwareWidget from "./note_context_aware_widget.js";
    +
    +const WIDGET_TPL = `
    +<div class="card widget">
    +    <div class="card-header"></div>
    +
    +    <div id="[to be set]" class="body-wrapper">
    +        <div class="card-body"></div>
    +    </div>
    +</div>`;
    +
    +/**
    + * This widget manages rendering panels in the right-hand pane.
    + * @extends {NoteContextAwareWidget}
    + */
    +class RightPanelWidget extends NoteContextAwareWidget {
    +    /** Title to show in the panel. */
    +    get widgetTitle() { return "Untitled widget"; }
    +
    +    get help() { return {}; }
    +
    +    /**
    +     * Do not override this method unless you know what you're doing.
    +     */
    +    doRender() {
    +        this.$widget = $(WIDGET_TPL);
    +        this.contentSized();
    +        this.$widget.find('[data-target]').attr('data-target', `#${this.componentId}`);
    +
    +        this.$bodyWrapper = this.$widget.find('.body-wrapper');
    +        this.$bodyWrapper.attr('id', this.componentId); // for toggle to work we need id
    +
    +        this.$body = this.$bodyWrapper.find('.card-body');
    +
    +        this.$title = this.$widget.find('.card-header');
    +        this.$title.text(this.widgetTitle);
    +
    +        this.initialized = this.doRenderBody();
    +    }
    +
    +    /**
    +     * Method used for rendering the body of the widget.
    +     * 
    +     * Your class should override this method.
    +     * @returns {JQuery<HTMLElement>} The body of your widget.
    +     */
    +    async doRenderBody() {}
    +}
    +
    +export default RightPanelWidget;
    +
    +
    + + + + +
    + + + +
    + + + + + + +