From 6bbff3efd82eb36b9060d60252c90ff358651405 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 11 Dec 2024 18:31:29 +0200 Subject: [PATCH] chore(frontend-docs): fix warnings & update --- docs/frontend_api/BasicWidget.html | 659 +++++++++++++++++- docs/frontend_api/FAttachment.html | 2 +- docs/frontend_api/FAttribute.html | 2 +- docs/frontend_api/FBranch.html | 2 +- docs/frontend_api/FNote.html | 142 ++-- docs/frontend_api/FrontendScriptApi.html | 98 +-- docs/frontend_api/NoteContextAwareWidget.html | 592 +++++++++++++++- docs/frontend_api/RightPanelWidget.html | 593 +++++++++++++++- .../frontend_api/entities_fattachment.js.html | 2 +- docs/frontend_api/entities_fattribute.js.html | 2 +- docs/frontend_api/entities_fblob.js.html | 2 +- docs/frontend_api/entities_fbranch.js.html | 2 +- docs/frontend_api/entities_fnote.js.html | 5 +- docs/frontend_api/global.html | 6 +- docs/frontend_api/index.html | 2 +- .../services_frontend_script_api.js.html | 14 +- .../frontend_api/widgets_basic_widget.js.html | 83 ++- .../widgets_note_context_aware_widget.js.html | 19 +- .../widgets_right_panel_widget.js.html | 8 +- src/public/app/widgets/basic_widget.js | 2 +- .../app/widgets/note_context_aware_widget.js | 2 +- 21 files changed, 2070 insertions(+), 169 deletions(-) diff --git a/docs/frontend_api/BasicWidget.html b/docs/frontend_api/BasicWidget.html index 2e8edd905..69f029e13 100644 --- a/docs/frontend_api/BasicWidget.html +++ b/docs/frontend_api/BasicWidget.html @@ -95,7 +95,7 @@ For information on using widgets, see the tutorial widget_basics.
Source:
@@ -151,6 +151,176 @@ For information on using widgets, see the tutorial widget_basics. +

css(name, value)

+ + + + + + +
+ Sets the CSS attribute of the given name to the given value. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + the name of the CSS attribute to set (e.g. `padding-left`).
value + + +string + + + + the value of the CSS attribute to set (e.g. `12px`).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + + + + + + +

cssBlock(block) → {this}

@@ -252,7 +422,7 @@ For information on using widgets, see the tutorial widget_basics.
Source:
@@ -365,7 +535,7 @@ The method is expected to create a this.$widget containing jQuery object
Source:
@@ -395,6 +565,487 @@ The method is expected to create a this.$widget containing jQuery object + + + + + + +

isEnabled()

+ + + + + + +
+ Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ whether the widget is enabled. +
+ + + + + + + + + + + + + + + +

optChild(condition, …components)

+ + + + + + +
+ Conditionally adds the given components as children to this component. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
condition + + +boolean + + + + + + + + + + whether to add the components.
components + + +any + + + + + + + + + + <repeatable>
+ +
the components to be added as children to this component provided the condition is truthy.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + + + + + + + +

optCss(condition, name, value)

+ + + + + + +
+ Sets the CSS attribute of the given name to the given value, but only if the condition provided is truthy. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
condition + + +boolean + + + + `true` in order to apply the CSS, `false` to ignore it.
name + + +string + + + + the name of the CSS attribute to set (e.g. `padding-left`).
value + + +string + + + + the value of the CSS attribute to set (e.g. `12px`).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + @@ -417,7 +1068,7 @@ The method is expected to create a this.$widget containing jQuery object
diff --git a/docs/frontend_api/FAttachment.html b/docs/frontend_api/FAttachment.html index 1a5d764ee..60f500c85 100644 --- a/docs/frontend_api/FAttachment.html +++ b/docs/frontend_api/FAttachment.html @@ -1058,7 +1058,7 @@ being a hidden child.
diff --git a/docs/frontend_api/FAttribute.html b/docs/frontend_api/FAttribute.html index 81679fb79..4516e1f1d 100644 --- a/docs/frontend_api/FAttribute.html +++ b/docs/frontend_api/FAttribute.html @@ -918,7 +918,7 @@ and relation (representing named relationship between source and target note) diff --git a/docs/frontend_api/FBranch.html b/docs/frontend_api/FBranch.html index e00fbede0..5ce64a09f 100644 --- a/docs/frontend_api/FBranch.html +++ b/docs/frontend_api/FBranch.html @@ -1130,7 +1130,7 @@ parents.
diff --git a/docs/frontend_api/FNote.html b/docs/frontend_api/FNote.html index 09040de56..49208f06d 100644 --- a/docs/frontend_api/FNote.html +++ b/docs/frontend_api/FNote.html @@ -165,7 +165,7 @@
Source:
@@ -268,7 +268,7 @@
Source:
@@ -336,7 +336,7 @@
Source:
@@ -404,7 +404,7 @@
Source:
@@ -472,7 +472,7 @@
Source:
@@ -540,7 +540,7 @@
Source:
@@ -608,7 +608,7 @@
Source:
@@ -680,7 +680,7 @@
Source:
@@ -748,7 +748,7 @@
Source:
@@ -816,7 +816,7 @@
Source:
@@ -884,7 +884,7 @@
Source:
@@ -952,7 +952,7 @@
Source:
@@ -1020,7 +1020,7 @@
Source:
@@ -1092,7 +1092,7 @@
Source:
@@ -1172,7 +1172,7 @@
Source:
@@ -1278,7 +1278,7 @@
Source:
@@ -1380,7 +1380,7 @@
Source:
@@ -1482,7 +1482,7 @@
Source:
@@ -1656,7 +1656,7 @@
Source:
@@ -1834,7 +1834,7 @@
Source:
@@ -2034,7 +2034,7 @@
Source:
@@ -2213,7 +2213,7 @@
Source:
@@ -2392,7 +2392,7 @@
Source:
@@ -2498,7 +2498,7 @@
Source:
@@ -2602,7 +2602,7 @@
Source:
@@ -2706,7 +2706,7 @@
Source:
@@ -2808,7 +2808,7 @@
Source:
@@ -2910,7 +2910,7 @@
Source:
@@ -3012,7 +3012,7 @@
Source:
@@ -3163,7 +3163,7 @@
Source:
@@ -3318,7 +3318,7 @@
Source:
@@ -3485,7 +3485,7 @@
Source:
@@ -3595,7 +3595,7 @@
Source:
@@ -3699,7 +3699,7 @@
Source:
@@ -3801,7 +3801,7 @@
Source:
@@ -3975,7 +3975,7 @@
Source:
@@ -4153,7 +4153,7 @@
Source:
@@ -4353,7 +4353,7 @@
Source:
@@ -4508,7 +4508,7 @@
Source:
@@ -4663,7 +4663,7 @@
Source:
@@ -4830,7 +4830,7 @@
Source:
@@ -4985,7 +4985,7 @@
Source:
@@ -5140,7 +5140,7 @@
Source:
@@ -5307,7 +5307,7 @@
Source:
@@ -5413,7 +5413,7 @@
Source:
@@ -5515,7 +5515,7 @@
Source:
@@ -5617,7 +5617,7 @@
Source:
@@ -5719,7 +5719,7 @@
Source:
@@ -5870,7 +5870,7 @@
Source:
@@ -6025,7 +6025,7 @@
Source:
@@ -6195,7 +6195,7 @@
Source:
@@ -6346,7 +6346,7 @@
Source:
@@ -6513,7 +6513,7 @@
Source:
@@ -6619,7 +6619,7 @@
Source:
@@ -6797,7 +6797,7 @@
Source:
@@ -6903,7 +6903,7 @@
Source:
@@ -7009,7 +7009,7 @@
Source:
@@ -7183,7 +7183,7 @@
Source:
@@ -7289,7 +7289,7 @@
Source:
@@ -7440,7 +7440,7 @@
Source:
@@ -7618,7 +7618,7 @@
Source:
@@ -7773,7 +7773,7 @@
Source:
@@ -7928,7 +7928,7 @@
Source:
@@ -8083,7 +8083,7 @@
Source:
@@ -8191,7 +8191,7 @@
Source:
@@ -8275,7 +8275,7 @@
Source:
@@ -8369,7 +8369,7 @@
Source:
@@ -8475,7 +8475,7 @@
Source:
@@ -8581,7 +8581,7 @@
Source:
@@ -8732,7 +8732,7 @@
Source:
@@ -8806,7 +8806,7 @@
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html index 85072e613..b4ba0f146 100644 --- a/docs/frontend_api/FrontendScriptApi.html +++ b/docs/frontend_api/FrontendScriptApi.html @@ -462,7 +462,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
Source:
@@ -1530,7 +1530,7 @@ See https://day.js.org for documentation
Source:
@@ -1738,7 +1738,7 @@ See https://day.js.org for documentation
Source:
@@ -2157,7 +2157,7 @@ See https://day.js.org for documentation
Source:
@@ -2312,7 +2312,7 @@ See https://day.js.org for documentation
Source:
@@ -2469,7 +2469,7 @@ See https://day.js.org for documentation
Source:
@@ -2624,7 +2624,7 @@ See https://day.js.org for documentation
Source:
@@ -2730,7 +2730,7 @@ See https://day.js.org for documentation
Source:
@@ -2840,7 +2840,7 @@ See https://day.js.org for documentation
Source:
@@ -2946,7 +2946,7 @@ See https://day.js.org for documentation
Source:
@@ -3052,7 +3052,7 @@ See https://day.js.org for documentation
Source:
@@ -3162,7 +3162,7 @@ See https://day.js.org for documentation
Source:
@@ -3268,7 +3268,7 @@ See https://day.js.org for documentation
Source:
@@ -3379,7 +3379,7 @@ implementation of actual widget type.
Source:
@@ -3534,7 +3534,7 @@ implementation of actual widget type.
Source:
@@ -3689,7 +3689,7 @@ implementation of actual widget type.
Source:
@@ -3796,7 +3796,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3898,7 +3898,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4057,7 +4057,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4213,7 +4213,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4315,7 +4315,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4520,7 +4520,7 @@ otherwise (by e.g. createLink())
Source:
@@ -4626,7 +4626,7 @@ otherwise (by e.g. createLink())
Source:
@@ -4781,7 +4781,7 @@ otherwise (by e.g. createLink())
Source:
@@ -4936,7 +4936,7 @@ otherwise (by e.g. createLink())
Source:
@@ -5086,7 +5086,7 @@ otherwise (by e.g. createLink())
Source:
@@ -5593,7 +5593,7 @@ otherwise (by e.g. createLink())
Source:
@@ -5771,7 +5771,7 @@ otherwise (by e.g. createLink())
Source:
@@ -5945,7 +5945,7 @@ otherwise (by e.g. createLink())
Source:
@@ -6100,7 +6100,7 @@ otherwise (by e.g. createLink())
Source:
@@ -6254,7 +6254,7 @@ otherwise (by e.g. createLink())
Source:
@@ -6409,7 +6409,7 @@ otherwise (by e.g. createLink())
Source:
@@ -6578,7 +6578,7 @@ If you have a synchronous function, please use api.runOnBackend().
Source:
@@ -6833,7 +6833,7 @@ with transaction management. If you really know what you're doing, you can call
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 +"#dateModified =* MONTH AND #log". See full documentation for all options at: https://triliumnext.github.io/Docs/Wiki/search.html
@@ -6926,7 +6926,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -6989,7 +6989,7 @@ with transaction management. If you really know what you're doing, you can call
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 +"#dateModified =* MONTH AND #log". See full documentation for all options at: https://triliumnext.github.io/Docs/Wiki/search.html
@@ -7082,7 +7082,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -7144,7 +7144,7 @@ with transaction management. If you really know what you're doing, you can call
- Hoist note in the current tab. See https://github.com/zadam/trilium/wiki/Note-hoisting + Hoist note in the current tab. See https://triliumnext.github.io/Docs/Wiki/note-hoisting.html
@@ -7237,7 +7237,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -7388,7 +7388,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -7543,7 +7543,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -7702,7 +7702,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -7839,7 +7839,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -7994,7 +7994,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -8226,7 +8226,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -8408,7 +8408,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -8568,7 +8568,7 @@ with transaction management. If you really know what you're doing, you can call
Source:
@@ -8660,7 +8660,7 @@ Typical use case is when a new note has been created, we should wait until it is
Source:
@@ -8730,7 +8730,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 index cafbd5af4..09a02b6d9 100644 --- a/docs/frontend_api/NoteContextAwareWidget.html +++ b/docs/frontend_api/NoteContextAwareWidget.html @@ -320,7 +320,7 @@
Source:
@@ -464,6 +464,181 @@ +

css(name, value)

+ + + + + + +
+ Sets the CSS attribute of the given name to the given value. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + the name of the CSS attribute to set (e.g. `padding-left`).
value + + +string + + + + the value of the CSS attribute to set (e.g. `12px`).
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + + + + + + +

cssBlock(block) → {this}

@@ -570,7 +745,7 @@
Source:
@@ -688,7 +863,7 @@ The method is expected to create a this.$widget containing jQuery object
Source:
@@ -731,6 +906,13 @@ The method is expected to create a this.$widget containing jQuery object +
+ Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden. + +

+If the widget is not enabled, it will not receive `refreshWithNote` updates. +

+ @@ -752,6 +934,11 @@ The method is expected to create a this.$widget containing jQuery object +
Overrides:
+
+ @@ -772,7 +959,7 @@ The method is expected to create a this.$widget containing jQuery object
Source:
@@ -830,6 +1017,399 @@ The method is expected to create a this.$widget containing jQuery object +

optChild(condition, …components)

+ + + + + + +
+ Conditionally adds the given components as children to this component. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
condition + + +boolean + + + + + + + + + + whether to add the components.
components + + +any + + + + + + + + + + <repeatable>
+ +
the components to be added as children to this component provided the condition is truthy.
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + + + + + + + +

optCss(condition, name, value)

+ + + + + + +
+ Sets the CSS attribute of the given name to the given value, but only if the condition provided is truthy. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
condition + + +boolean + + + + `true` in order to apply the CSS, `false` to ignore it.
name + + +string + + + + the name of the CSS attribute to set (e.g. `padding-left`).
value + + +string + + + + the value of the CSS attribute to set (e.g. `12px`).
+ + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + + + + + + +

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

@@ -932,7 +1512,7 @@ widget with each note.
Source:
@@ -1002,7 +1582,7 @@ widget with each note.
diff --git a/docs/frontend_api/RightPanelWidget.html b/docs/frontend_api/RightPanelWidget.html index 307ecefd4..855aab27b 100644 --- a/docs/frontend_api/RightPanelWidget.html +++ b/docs/frontend_api/RightPanelWidget.html @@ -93,7 +93,7 @@
Source:
@@ -335,7 +335,7 @@
Source:
@@ -523,7 +523,7 @@
Source:
@@ -551,6 +551,181 @@ +

css(name, value)

+ + + + + + +
+ Sets the CSS attribute of the given name to the given value. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + the name of the CSS attribute to set (e.g. `padding-left`).
value + + +string + + + + the value of the CSS attribute to set (e.g. `12px`).
+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + + + + + + +

cssBlock(block) → {this}

@@ -657,7 +832,7 @@
Source:
@@ -773,7 +948,7 @@ Do not override this method unless you know what you're doing.
Source:
@@ -863,7 +1038,7 @@ Your class should override this method.
Source:
@@ -931,6 +1106,13 @@ Your class should override this method. +
+ Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden. + +

+If the widget is not enabled, it will not receive `refreshWithNote` updates. +

+ @@ -977,7 +1159,7 @@ Your class should override this method.
Source:
@@ -1035,6 +1217,399 @@ Your class should override this method. +

optChild(condition, …components)

+ + + + + + +
+ Conditionally adds the given components as children to this component. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
condition + + +boolean + + + + + + + + + + whether to add the components.
components + + +any + + + + + + + + + + <repeatable>
+ +
the components to be added as children to this component provided the condition is truthy.
+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + + + + + + + +

optCss(condition, name, value)

+ + + + + + +
+ Sets the CSS attribute of the given name to the given value, but only if the condition provided is truthy. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
condition + + +boolean + + + + `true` in order to apply the CSS, `false` to ignore it.
name + + +string + + + + the name of the CSS attribute to set (e.g. `padding-left`).
value + + +string + + + + the value of the CSS attribute to set (e.g. `12px`).
+ + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ self for chaining. +
+ + + + + + + + + + + + + + +

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

@@ -1142,7 +1717,7 @@ widget with each note.
Source:
@@ -1212,7 +1787,7 @@ widget with each note.
diff --git a/docs/frontend_api/entities_fattachment.js.html b/docs/frontend_api/entities_fattachment.js.html index 1b301f3b9..e38fc1ecb 100644 --- a/docs/frontend_api/entities_fattachment.js.html +++ b/docs/frontend_api/entities_fattachment.js.html @@ -93,7 +93,7 @@ export default FAttachment;
diff --git a/docs/frontend_api/entities_fattribute.js.html b/docs/frontend_api/entities_fattribute.js.html index de5addfac..7f0cd60cc 100644 --- a/docs/frontend_api/entities_fattribute.js.html +++ b/docs/frontend_api/entities_fattribute.js.html @@ -127,7 +127,7 @@ export default FAttribute;
diff --git a/docs/frontend_api/entities_fblob.js.html b/docs/frontend_api/entities_fblob.js.html index 284d2542b..b4170baea 100644 --- a/docs/frontend_api/entities_fblob.js.html +++ b/docs/frontend_api/entities_fblob.js.html @@ -81,7 +81,7 @@
diff --git a/docs/frontend_api/entities_fbranch.js.html b/docs/frontend_api/entities_fbranch.js.html index faad3c117..9f3af1a28 100644 --- a/docs/frontend_api/entities_fbranch.js.html +++ b/docs/frontend_api/entities_fbranch.js.html @@ -106,7 +106,7 @@ export default FBranch;
diff --git a/docs/frontend_api/entities_fnote.js.html b/docs/frontend_api/entities_fnote.js.html index 655101712..b3fc9c853 100644 --- a/docs/frontend_api/entities_fnote.js.html +++ b/docs/frontend_api/entities_fnote.js.html @@ -50,7 +50,8 @@ const NOTE_TYPE_ICONS = { "webView": "bx bx-globe-alt", "launcher": "bx bx-link", "doc": "bx bxs-file-doc", - "contentWidget": "bx bxs-widget" + "contentWidget": "bx bxs-widget", + "mindMap": "bx bx-sitemap" }; /** @@ -1054,7 +1055,7 @@ export default FNote;
diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.html index 5e4f2f1ae..3a73d00e8 100644 --- a/docs/frontend_api/global.html +++ b/docs/frontend_api/global.html @@ -674,7 +674,7 @@
Source:
@@ -790,7 +790,7 @@ not for direct use.
Source:
@@ -898,7 +898,7 @@ not for direct use.
diff --git a/docs/frontend_api/index.html b/docs/frontend_api/index.html index 27b2a8b84..e15c1dea5 100644 --- a/docs/frontend_api/index.html +++ b/docs/frontend_api/index.html @@ -56,7 +56,7 @@
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index eded4a0c0..cb50e8197 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -245,8 +245,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain */ this.runOnBackend = async (func, params = []) => { if (func?.constructor.name === "AsyncFunction" || func?.startsWith?.("async ")) { - toastService.showError("You're passing an async function to api.runOnBackend() which will likely not work as you intended. " - + "Either make the function synchronous (by removing 'async' keyword), or use api.runAsyncOnBackendWithManualTransactionHandling()"); + toastService.showError(t("frontend_script_api.async_warning")); } return await this.__runOnBackendInner(func, params, true); @@ -268,8 +267,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain */ this.runAsyncOnBackendWithManualTransactionHandling = async (func, params = []) => { if (func?.constructor.name === "Function" || func?.startsWith?.("function")) { - toastService.showError("You're passing a synchronous function to api.runAsyncOnBackendWithManualTransactionHandling(), " + - "while you should likely use api.runOnBackend() instead."); + toastService.showError(t("frontend_script_api.sync_warning")); } return await this.__runOnBackendInner(func, params, false); @@ -277,7 +275,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain /** * 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 + * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://triliumnext.github.io/Docs/Wiki/search.html * * @method * @param {string} searchString @@ -289,7 +287,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain /** * 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 + * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://triliumnext.github.io/Docs/Wiki/search.html * * @method * @param {string} searchString @@ -586,7 +584,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain this.getYearNote = dateNotesService.getYearNote; /** - * Hoist note in the current tab. See https://github.com/zadam/trilium/wiki/Note-hoisting + * Hoist note in the current tab. See https://triliumnext.github.io/Docs/Wiki/note-hoisting.html * * @method * @param {string} noteId - set hoisted note. 'root' will effectively unhoist @@ -700,7 +698,7 @@ export default FrontendScriptApi;
diff --git a/docs/frontend_api/widgets_basic_widget.js.html b/docs/frontend_api/widgets_basic_widget.js.html index 6a203fd6d..9d36a448f 100644 --- a/docs/frontend_api/widgets_basic_widget.js.html +++ b/docs/frontend_api/widgets_basic_widget.js.html @@ -27,7 +27,9 @@
import Component from "../components/component.js";
-
+import froca from "../services/froca.js";
+import { t } from "../services/i18n.js";
+import toastService from "../services/toast.js";
 
 /**
  * This is the base widget for all other widgets.
@@ -66,6 +68,21 @@ class BasicWidget extends Component {
         return this;
     }
 
+    /**
+     * Conditionally adds the given components as children to this component.
+     * 
+     * @param {boolean} condition whether to add the components.
+     * @param  {...any} components the components to be added as children to this component provided the condition is truthy. 
+     * @returns self for chaining.
+     */
+    optChild(condition, ...components) {
+        if (condition) {
+            return this.child(...components);
+        } else {
+            return this;
+        }
+    }
+
     id(id) {
         this.attrs.id = id;
         return this;
@@ -76,11 +93,34 @@ class BasicWidget extends Component {
         return this;
     }
 
+    /**
+     * Sets the CSS attribute of the given name to the given value.
+     * 
+     * @param {string} name the name of the CSS attribute to set (e.g. `padding-left`).
+     * @param {string} value the value of the CSS attribute to set (e.g. `12px`).
+     * @returns self for chaining.
+     */
     css(name, value) {
         this.attrs.style += `${name}: ${value};`;
         return this;
     }
 
+    /**
+     * Sets the CSS attribute of the given name to the given value, but only if the condition provided is truthy.
+     * 
+     * @param {boolean} condition `true` in order to apply the CSS, `false` to ignore it.
+     * @param {string} name the name of the CSS attribute to set (e.g. `padding-left`).
+     * @param {string} value the value of the CSS attribute to set (e.g. `12px`).
+     * @returns self for chaining.
+     */
+    optCss(condition, name, value) {
+        if (condition) {
+            return this.css(name, value);
+        }
+
+        return this;
+    }
+
     contentSized() {
         this.css("contain", "none");
 
@@ -109,7 +149,11 @@ class BasicWidget extends Component {
     }
 
     render() {
-        this.doRender();
+        try {
+            this.doRender();
+        } catch (e) {                        
+            this.logRenderingError(e);
+        }
 
         this.$widget.attr('data-component-id', this.componentId);
         this.$widget
@@ -147,6 +191,39 @@ class BasicWidget extends Component {
         return this.$widget;
     }
 
+    logRenderingError(e) {
+        console.log("Got issue in widget ", this);
+        console.error(e);
+
+        let noteId = this._noteId;
+        if (this._noteId) {
+            froca.getNote(noteId, true).then((note) => {
+                toastService.showPersistent({
+                    title: t("toast.widget-error.title"),
+                    icon: "alert",
+                    message: t("toast.widget-error.message-custom", {
+                        id: noteId,
+                        title: note.title,
+                        message: e.message
+                    })
+                });
+            });
+            return;
+        }
+
+        toastService.showPersistent({
+            title: t("toast.widget-error.title"),
+            icon: "alert",
+            message: t("toast.widget-error.message-unknown", {
+                message: e.message
+            })
+        });
+    }
+
+    /**
+     * Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden.
+     * @returns whether the widget is enabled.
+     */
     isEnabled() {
         return true;
     }
@@ -222,7 +299,7 @@ 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 index e9f707f32..bbc72f6a3 100644 --- a/docs/frontend_api/widgets_note_context_aware_widget.js.html +++ b/docs/frontend_api/widgets_note_context_aware_widget.js.html @@ -76,6 +76,11 @@ class NoteContextAwareWidget extends BasicWidget { } /** + * Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden. + * + * <p> + * If the widget is not enabled, it will not receive `refreshWithNote` updates. + * * @returns {boolean} true when an active note exists */ isEnabled() { @@ -85,7 +90,17 @@ class NoteContextAwareWidget extends BasicWidget { async refresh() { if (this.isEnabled()) { this.toggleInt(true); - await this.refreshWithNote(this.note); + + try { + await this.refreshWithNote(this.note); + } catch (e) { + // Ignore errors when user is refreshing or navigating away. + if (e === "rejected by browser") { + return; + } + + throw e; + } } else { this.toggleInt(false); @@ -164,7 +179,7 @@ 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 index cf98c0aa5..cb63ea9fd 100644 --- a/docs/frontend_api/widgets_right_panel_widget.js.html +++ b/docs/frontend_api/widgets_right_panel_widget.js.html @@ -27,6 +27,8 @@
import NoteContextAwareWidget from "./note_context_aware_widget.js";
+import toastService from "../services/toast.js";
+import { t } from "../services/i18n.js";
 
 const WIDGET_TPL = `
 <div class="card widget">
@@ -82,7 +84,9 @@ class RightPanelWidget extends NoteContextAwareWidget {
             this.$buttons.append(buttonWidget.render());
         }
 
-        this.initialized = this.doRenderBody();
+        this.initialized = this.doRenderBody().catch(e => {
+            this.logRenderingError(e);
+        });
     }
 
     /**
@@ -111,7 +115,7 @@ export default RightPanelWidget;
 
diff --git a/src/public/app/widgets/basic_widget.js b/src/public/app/widgets/basic_widget.js index 33ade4cb4..54b0b92a7 100644 --- a/src/public/app/widgets/basic_widget.js +++ b/src/public/app/widgets/basic_widget.js @@ -194,7 +194,7 @@ class BasicWidget extends Component { /** * Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden. - * @returns + * @returns whether the widget is enabled. */ isEnabled() { return true; diff --git a/src/public/app/widgets/note_context_aware_widget.js b/src/public/app/widgets/note_context_aware_widget.js index 06e6219e4..014775210 100644 --- a/src/public/app/widgets/note_context_aware_widget.js +++ b/src/public/app/widgets/note_context_aware_widget.js @@ -48,7 +48,7 @@ class NoteContextAwareWidget extends BasicWidget { } /** - * @inheritdoc + * Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden. * *

* If the widget is not enabled, it will not receive `refreshWithNote` updates.