diff --git a/docs/backend_api/BAttachment.html b/docs/backend_api/BAttachment.html index 985ee21e9..50e40c1e3 100644 --- a/docs/backend_api/BAttachment.html +++ b/docs/backend_api/BAttachment.html @@ -1388,7 +1388,7 @@ larger amounts of data and generally not accessible to the user.
api.showMessage(api.s
- Source:
@@ -236,7 +236,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -342,7 +342,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -448,7 +448,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -554,7 +554,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -614,7 +614,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -724,7 +724,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -834,7 +834,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -947,7 +947,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -1057,7 +1057,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -1186,7 +1186,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -1341,7 +1341,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -1682,7 +1682,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -1819,7 +1819,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -2027,7 +2027,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -2409,7 +2409,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -2564,7 +2564,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -2721,7 +2721,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -2876,7 +2876,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -2986,7 +2986,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -3092,7 +3092,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -3198,7 +3198,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -3308,7 +3308,7 @@ available in the JS frontend notes. You can use e.g. api.showMessage(api.s
- Source:
@@ -3419,7 +3419,7 @@ implementation of actual widget type.
- Source:
@@ -3574,7 +3574,7 @@ implementation of actual widget type.
- Source:
@@ -3729,7 +3729,7 @@ implementation of actual widget type.
- Source:
@@ -3836,7 +3836,7 @@ if some action needs to happen on only one specific instance.
- Source:
@@ -3991,7 +3991,7 @@ if some action needs to happen on only one specific instance.
- Source:
@@ -4147,7 +4147,7 @@ if some action needs to happen on only one specific instance.
- Source:
@@ -4348,7 +4348,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -4454,7 +4454,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -4609,7 +4609,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -4764,7 +4764,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -4914,7 +4914,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -5092,7 +5092,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -5270,7 +5270,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -5421,7 +5421,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -5599,7 +5599,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -5773,7 +5773,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -5928,7 +5928,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -6082,7 +6082,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -6237,7 +6237,7 @@ otherwise (by e.g. createLink())
- Source:
@@ -6398,7 +6398,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -6558,7 +6558,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -6714,7 +6714,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -6869,7 +6869,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7020,7 +7020,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7074,7 +7074,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- showError(message)
+ showConfirmDialog(message) → {Promise.<boolean>}
@@ -7082,7 +7082,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.
@@ -7175,7 +7175,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7200,6 +7200,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
+
+
+
+
+
+
@@ -7219,7 +7533,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.
@@ -7312,7 +7626,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7342,6 +7656,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>
+
+
+
+
+
+
+
+
+
+
+
@@ -7472,7 +8040,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7632,7 +8200,7 @@ Internally this serializes the anonymous function into string and sends it to ba
- Source:
@@ -7724,7 +8292,7 @@ Typical use case is when a new note has been created, we should wait until it is
- Source:
@@ -7788,7 +8356,7 @@ Typical use case is when a new note has been created, we should wait until it is
diff --git a/docs/frontend_api/entities_fattachment.js.html b/docs/frontend_api/entities_fattachment.js.html
index b2137c353..c49ab8dd2 100644
--- a/docs/frontend_api/entities_fattachment.js.html
+++ b/docs/frontend_api/entities_fattachment.js.html
@@ -80,7 +80,7 @@ export default FAttachment;
diff --git a/docs/frontend_api/entities_fattribute.js.html b/docs/frontend_api/entities_fattribute.js.html
index abbb8b686..7daa67ff2 100644
--- a/docs/frontend_api/entities_fattribute.js.html
+++ b/docs/frontend_api/entities_fattribute.js.html
@@ -116,7 +116,7 @@ export default FAttribute;
diff --git a/docs/frontend_api/entities_fblob.js.html b/docs/frontend_api/entities_fblob.js.html
index 311c1fe77..e98ee01c6 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 1d663d7de..f2049871d 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 2893ad25b..d6f68bcca 100644
--- a/docs/frontend_api/entities_fnote.js.html
+++ b/docs/frontend_api/entities_fnote.js.html
@@ -264,6 +264,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();
@@ -998,6 +1004,10 @@ class FNote {
isOptions() {
return this.noteId.startsWith("_options");
}
+
+ async getMetadata() {
+ return await server.get(`notes/${this.noteId}/metadata`);
+ }
}
export default FNote;
@@ -1011,7 +1021,7 @@ export default FNote;
diff --git a/docs/frontend_api/index.html b/docs/frontend_api/index.html
index 46ccdc9a8..1fc84f364 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 96cc31057..3c978b25c 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";
/**
* <p>This is the main frontend API interface for scripts. All the properties and methods are published in the "api" object
@@ -286,7 +287,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
@@ -294,13 +295,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.
*
@@ -570,7 +601,7 @@ export default FrontendScriptApi;