diff --git a/docs/backend_api/BNote.html b/docs/backend_api/BNote.html index fe51bc8b1..ae7f777a7 100644 --- a/docs/backend_api/BNote.html +++ b/docs/backend_api/BNote.html @@ -1588,7 +1588,7 @@ See addLabel, addRelation for more specific methods.
api.showMessage(api.s
- Source:
@@ -198,7 +198,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -266,7 +266,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -334,7 +334,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -402,7 +402,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -462,7 +462,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -534,7 +534,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -607,7 +607,7 @@ See https://day.js.org for documentation
- Source:
@@ -689,7 +689,7 @@ See https://day.js.org for documentation
- Source:
@@ -761,7 +761,7 @@ See https://day.js.org for documentation
- Source:
@@ -890,7 +890,7 @@ See https://day.js.org for documentation
- Source:
@@ -1045,7 +1045,7 @@ See https://day.js.org for documentation
- Source:
@@ -1393,7 +1393,7 @@ See https://day.js.org for documentation
- 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:
@@ -5264,7 +5264,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -5442,7 +5442,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:
@@ -6573,7 +6573,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -6733,7 +6733,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -6889,7 +6889,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7044,7 +7044,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7195,7 +7195,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7249,7 +7249,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- showError(message)
+ showConfirmDialog(message) → {Promise.<boolean>}
@@ -7257,7 +7257,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Show an error message to the user.
+ Show confirm dialog to the user.
@@ -7350,7 +7350,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7375,6 +7375,320 @@ Internally this serializes the anonymous function into string and sends it to ba
+Returns:
+
+
+
+ promise resolving to true if the user confirmed
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise.<boolean>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ showError(message)
+
+
+
+
+
+
+
+ Show an error toast message to the user.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ message
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ showInfoDialog(message) → {Promise}
+
+
+
+
+
+
+
+ Show an info dialog to the user.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ message
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise
+
+
+
+
+
+
@@ -7394,7 +7708,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Show an info message to the user.
+ Show an info toast message to the user.
@@ -7487,7 +7801,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7517,6 +7831,260 @@ Internally this serializes the anonymous function into string and sends it to ba
+
+
+
+
+
+
+ showPromptDialog(props) → {Promise.<string>}
+
+
+
+
+
+
+
+ Show prompt dialog to the user.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ props
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ title
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ message
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ defaultValue
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ promise resolving to the answer provided by the user
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise.<string>
+
+
+
+
+
+
+
+
+
+
+
@@ -7647,7 +8215,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7807,7 +8375,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7899,7 +8467,7 @@ Typical use case is when a new note has been created, we should wait until it is
- Source:
@@ -7963,7 +8531,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 3c5675db5..cd5cee960 100644
--- a/docs/frontend_api/NoteContextAwareWidget.html
+++ b/docs/frontend_api/NoteContextAwareWidget.html
@@ -1017,7 +1017,7 @@ widget with each note.
diff --git a/docs/frontend_api/RightPanelWidget.html b/docs/frontend_api/RightPanelWidget.html
index a6bea6e25..2913dd240 100644
--- a/docs/frontend_api/RightPanelWidget.html
+++ b/docs/frontend_api/RightPanelWidget.html
@@ -1202,7 +1202,7 @@ widget with each note.
diff --git a/docs/frontend_api/entities_fattachment.js.html b/docs/frontend_api/entities_fattachment.js.html
index 5397b6a38..1b301f3b9 100644
--- a/docs/frontend_api/entities_fattachment.js.html
+++ b/docs/frontend_api/entities_fattachment.js.html
@@ -87,7 +87,7 @@ export default FAttachment;
diff --git a/docs/frontend_api/entities_fattribute.js.html b/docs/frontend_api/entities_fattribute.js.html
index 00da37ca1..de5addfac 100644
--- a/docs/frontend_api/entities_fattribute.js.html
+++ b/docs/frontend_api/entities_fattribute.js.html
@@ -121,7 +121,7 @@ export default FAttribute;
diff --git a/docs/frontend_api/entities_fblob.js.html b/docs/frontend_api/entities_fblob.js.html
index 811119774..284d2542b 100644
--- a/docs/frontend_api/entities_fblob.js.html
+++ b/docs/frontend_api/entities_fblob.js.html
@@ -43,6 +43,27 @@
/** @type {string} */
this.utcDateModified = row.utcDateModified;
}
+
+ /**
+ * @returns {*}
+ * @throws Error in case of invalid JSON */
+ getJsonContent() {
+ if (!this.content || !this.content.trim()) {
+ return null;
+ }
+
+ return JSON.parse(this.content);
+ }
+
+ /** @returns {*|null} valid object or null if the content cannot be parsed as JSON */
+ getJsonContentSafely() {
+ try {
+ return this.getJsonContent();
+ }
+ catch (e) {
+ return null;
+ }
+ }
}
@@ -54,7 +75,7 @@
diff --git a/docs/frontend_api/entities_fbranch.js.html b/docs/frontend_api/entities_fbranch.js.html
index 95ef4d084..faad3c117 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 77158873e..bcfc47f04 100644
--- a/docs/frontend_api/entities_fnote.js.html
+++ b/docs/frontend_api/entities_fnote.js.html
@@ -283,6 +283,12 @@ class FNote {
return this.attachments;
}
+ /** @returns {Promise<FAttachment[]>} */
+ async getAttachmentsByRole(role) {
+ return (await this.getAttachments())
+ .filter(attachment => attachment.role === role);
+ }
+
/** @returns {Promise<FAttachment>} */
async getAttachmentById(attachmentId) {
const attachments = await this.getAttachments();
@@ -1039,7 +1045,7 @@ export default FNote;
diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.html
index 9c8dcdc9d..5e4f2f1ae 100644
--- a/docs/frontend_api/global.html
+++ b/docs/frontend_api/global.html
@@ -152,7 +152,7 @@
- Source:
@@ -172,6 +172,233 @@
+ Methods
+
+
+
+
+
+
+
+ getJsonContent() → {*}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ entities/fblob.js, line 22
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Throws:
+
+
+
+
+
+ Error in case of invalid JSON
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getJsonContentSafely() → {*|null}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ entities/fblob.js, line 31
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ valid object or null if the content cannot be parsed as JSON
+
+
+
+
+
+ -
+ Type
+
+ -
+
+*
+|
+
+null
+
+
+
+
+
+
+
+
+
+
+
+
+
Type Definitions
@@ -635,7 +862,7 @@ not for direct use.
- Source:
@@ -665,7 +892,7 @@ not for direct use.
diff --git a/docs/frontend_api/index.html b/docs/frontend_api/index.html
index 1c6319630..27b2a8b84 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 328ab4125..12becf7ac 100644
--- a/docs/frontend_api/services_frontend_script_api.js.html
+++ b/docs/frontend_api/services_frontend_script_api.js.html
@@ -42,6 +42,7 @@ import NoteContextAwareWidget from "../widgets/note_context_aware_widget.js";
import BasicWidget from "../widgets/basic_widget.js";
import SpacedUpdate from "./spaced_update.js";
import shortcutService from "./shortcuts.js";
+import dialogService from "./dialog.js";
/**
@@ -316,7 +317,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
this.parseDate = utils.parseDate;
/**
- * Show an info message to the user.
+ * Show an info toast message to the user.
*
* @method
* @param {string} message
@@ -324,13 +325,43 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
this.showMessage = toastService.showMessage;
/**
- * Show an error message to the user.
+ * Show an error toast message to the user.
*
* @method
* @param {string} message
*/
this.showError = toastService.showError;
+ /**
+ * Show an info dialog to the user.
+ *
+ * @method
+ * @param {string} message
+ * @returns {Promise}
+ */
+ this.showInfoDialog = dialogService.info;
+
+ /**
+ * Show confirm dialog to the user.
+ *
+ * @method
+ * @param {string} message
+ * @returns {Promise<boolean>} promise resolving to true if the user confirmed
+ */
+ this.showConfirmDialog = dialogService.confirm;
+
+ /**
+ * Show prompt dialog to the user.
+ *
+ * @method
+ * @param {object} props
+ * @param {string} props.title
+ * @param {string} props.message
+ * @param {string} props.defaultValue
+ * @returns {Promise<string>} promise resolving to the answer provided by the user
+ */
+ this.showPromptDialog = dialogService.prompt;
+
/**
* Trigger command. This is a very low-level API which should be avoided if possible.
*
@@ -625,7 +656,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 01c2dc537..3958f1096 100644
--- a/docs/frontend_api/widgets_basic_widget.js.html
+++ b/docs/frontend_api/widgets_basic_widget.js.html
@@ -215,7 +215,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 835692b26..e9f707f32 100644
--- a/docs/frontend_api/widgets_note_context_aware_widget.js.html
+++ b/docs/frontend_api/widgets_note_context_aware_widget.js.html
@@ -158,7 +158,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 25644d903..02cbbc4ac 100644
--- a/docs/frontend_api/widgets_right_panel_widget.js.html
+++ b/docs/frontend_api/widgets_right_panel_widget.js.html
@@ -85,7 +85,7 @@ export default RightPanelWidget;