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.
Source:
@@ -1835,7 +1835,7 @@ See addLabel, addRelation for more specific methods.
Source:
@@ -2081,7 +2081,7 @@ returned.
Source:
@@ -2316,7 +2316,7 @@ returned.
Source:
@@ -2432,7 +2432,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -2653,7 +2653,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -2919,7 +2919,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -3025,7 +3025,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -3127,7 +3127,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -3229,7 +3229,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -3286,7 +3286,7 @@ In the future, this functionality might get more generic and some of the require -

getAttachmentByRole() → {Array.<BAttachment>}

+

getAttachmentByTitle() → {BAttachment}

@@ -3334,7 +3334,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -3370,7 +3370,7 @@ In the future, this functionality might get more generic and some of the require
-Array.<BAttachment> +BAttachment
@@ -3436,7 +3436,109 @@ In the future, this functionality might get more generic and some of the require
Source:
+ + + + + + + + + + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<BAttachment> + + +
+
+ + + + + + + + + + + + + +

getAttachmentsByRole() → {Array.<BAttachment>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -3610,7 +3712,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -3789,7 +3891,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -3997,7 +4099,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -4176,7 +4278,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -4355,7 +4457,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -4876,7 +4978,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -4966,7 +5068,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -5072,7 +5174,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -5179,7 +5281,121 @@ In the future, this functionality might get more generic and some of the require
Source:
+ + + + + + + +
+ + + + + + + + + + + + + +
Throws:
+ + + +
+ + Error in case of invalid JSON + +
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + + + + +

getJsonContentSafely() → {*|null}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -5207,6 +5423,10 @@ In the future, this functionality might get more generic and some of the require
Returns:
+
+ valid object or null if the content cannot be parsed as JSON +
+
@@ -5216,6 +5436,9 @@ In the future, this functionality might get more generic and some of the require
* +| + +null
@@ -5330,7 +5553,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -5488,7 +5711,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -5658,7 +5881,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -5825,7 +6048,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -5931,7 +6154,7 @@ In the future, this functionality might get more generic and some of the require
Source:
@@ -6111,7 +6334,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6381,7 +6604,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6536,7 +6759,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6694,7 +6917,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6864,7 +7087,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7031,7 +7254,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7186,7 +7409,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7344,7 +7567,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7514,7 +7737,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7962,7 +8185,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8120,7 +8343,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8290,7 +8513,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8396,7 +8619,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8498,7 +8721,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8607,7 +8830,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8778,7 +9001,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8986,7 +9209,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9088,7 +9311,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9194,7 +9417,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9296,7 +9519,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9487,7 +9710,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9713,7 +9936,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10009,7 +10232,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10238,7 +10461,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10436,7 +10659,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10634,7 +10857,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10832,7 +11055,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10938,7 +11161,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11088,7 +11311,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11194,7 +11417,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11288,7 +11511,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11394,7 +11617,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11500,7 +11723,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11606,7 +11829,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11761,7 +11984,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11867,7 +12090,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -11975,7 +12198,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -12434,7 +12657,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -12614,7 +12837,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -12794,7 +13017,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -12989,7 +13212,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -13091,7 +13314,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -13323,7 +13546,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -13602,7 +13825,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -13782,7 +14005,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -13942,7 +14165,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -14184,7 +14407,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -14395,7 +14618,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -14606,7 +14829,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
Source:
diff --git a/docs/backend_api/becca_entities_bnote.js.html b/docs/backend_api/becca_entities_bnote.js.html index f69de3c68..0fb97f428 100644 --- a/docs/backend_api/becca_entities_bnote.js.html +++ b/docs/backend_api/becca_entities_bnote.js.html @@ -257,7 +257,9 @@ class BNote extends AbstractBeccaEntity { return this._getContent(); } - /** @returns {*} */ + /** + * @returns {*} + * @throws Error in case of invalid JSON */ getJsonContent() { const content = this.getContent(); @@ -268,6 +270,16 @@ class BNote extends AbstractBeccaEntity { return JSON.parse(content); } + /** @returns {*|null} valid object or null if the content cannot be parsed as JSON */ + getJsonContentSafely() { + try { + return this.getJsonContent(); + } + catch (e) { + return null; + } + } + /** * @param content * @param {object} [opts] @@ -1171,7 +1183,7 @@ class BNote extends AbstractBeccaEntity { } /** @returns {BAttachment[]} */ - getAttachmentByRole(role) { + getAttachmentsByRole(role) { return sql.getRows(` SELECT attachments.* FROM attachments @@ -1182,6 +1194,18 @@ class BNote extends AbstractBeccaEntity { .map(row => new BAttachment(row)); } + /** @returns {BAttachment} */ + getAttachmentByTitle(title) { + return sql.getRows(` + SELECT attachments.* + FROM attachments + WHERE ownerId = ? + AND title = ? + AND isDeleted = 0 + ORDER BY position`, [this.noteId, title]) + .map(row => new BAttachment(row))[0]; + } + /** * Gives all possible note paths leading to this note. Paths containing search note are ignored (could form cycles) * diff --git a/docs/frontend_api/BasicWidget.html b/docs/frontend_api/BasicWidget.html index 5383fc3b3..021f24af1 100644 --- a/docs/frontend_api/BasicWidget.html +++ b/docs/frontend_api/BasicWidget.html @@ -432,7 +432,7 @@ Your class should override this method.
diff --git a/docs/frontend_api/FAttachment.html b/docs/frontend_api/FAttachment.html index 50127636a..1a5d764ee 100644 --- a/docs/frontend_api/FAttachment.html +++ b/docs/frontend_api/FAttachment.html @@ -1052,7 +1052,7 @@ being a hidden child.
diff --git a/docs/frontend_api/FAttribute.html b/docs/frontend_api/FAttribute.html index 7c3103627..81679fb79 100644 --- a/docs/frontend_api/FAttribute.html +++ b/docs/frontend_api/FAttribute.html @@ -912,7 +912,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 7446e66da..e00fbede0 100644 --- a/docs/frontend_api/FBranch.html +++ b/docs/frontend_api/FBranch.html @@ -1124,7 +1124,7 @@ parents.
diff --git a/docs/frontend_api/FNote.html b/docs/frontend_api/FNote.html index 7d1352ff0..2145b836c 100644 --- a/docs/frontend_api/FNote.html +++ b/docs/frontend_api/FNote.html @@ -1172,7 +1172,7 @@
Source:
@@ -1278,7 +1278,7 @@
Source:
@@ -1405,6 +1405,108 @@ +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Array.<FAttachment>> + + +
+
+ + + + + + + + + + + + + +

(async) getAttachmentsByRole() → {Promise.<Array.<FAttachment>>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
Returns:
@@ -1554,7 +1656,7 @@
Source:
@@ -1732,7 +1834,7 @@
Source:
@@ -1932,7 +2034,7 @@
Source:
@@ -2111,7 +2213,7 @@
Source:
@@ -2290,7 +2392,7 @@
Source:
@@ -2396,7 +2498,7 @@
Source:
@@ -3061,7 +3163,7 @@
Source:
@@ -3216,7 +3318,7 @@
Source:
@@ -3383,7 +3485,7 @@
Source:
@@ -3493,7 +3595,7 @@
Source:
@@ -3597,7 +3699,7 @@
Source:
@@ -3699,7 +3801,7 @@
Source:
@@ -3873,7 +3975,7 @@
Source:
@@ -4051,7 +4153,7 @@
Source:
@@ -4251,7 +4353,7 @@
Source:
@@ -4406,7 +4508,7 @@
Source:
@@ -4561,7 +4663,7 @@
Source:
@@ -4728,7 +4830,7 @@
Source:
@@ -4883,7 +4985,7 @@
Source:
@@ -5038,7 +5140,7 @@
Source:
@@ -5205,7 +5307,7 @@
Source:
@@ -5768,7 +5870,7 @@
Source:
@@ -5923,7 +6025,7 @@
Source:
@@ -6093,7 +6195,7 @@
Source:
@@ -6244,7 +6346,7 @@
Source:
@@ -6411,7 +6513,7 @@
Source:
@@ -6517,7 +6619,7 @@
Source:
@@ -6695,7 +6797,7 @@
Source:
@@ -6801,7 +6903,7 @@
Source:
@@ -6907,7 +7009,7 @@
Source:
@@ -7081,7 +7183,7 @@
Source:
@@ -7338,7 +7440,7 @@
Source:
@@ -7516,7 +7618,7 @@
Source:
@@ -7671,7 +7773,7 @@
Source:
@@ -7826,7 +7928,7 @@
Source:
@@ -7981,7 +8083,7 @@
Source:
@@ -8089,7 +8191,7 @@
Source:
@@ -8173,7 +8275,7 @@
Source:
@@ -8267,7 +8369,7 @@
Source:
@@ -8373,7 +8475,7 @@
Source:
@@ -8630,7 +8732,7 @@
Source:
@@ -8698,7 +8800,7 @@
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html index dfa5d1e70..091a0a643 100644 --- a/docs/frontend_api/FrontendScriptApi.html +++ b/docs/frontend_api/FrontendScriptApi.html @@ -94,7 +94,7 @@ available in the JS frontend notes. You can use e.g. 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:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
message + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

showInfoDialog(message) → {Promise}

+ + + + + + +
+ Show an info dialog to the user. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
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:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
props + + +object + + + + +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
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:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Throws:
+ + + +
+ + Error in case of invalid JSON + +
+ + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + + + + + + + + + +

getJsonContentSafely() → {*|null}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
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;