diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html index 9f35c02f9..0588994f7 100644 --- a/docs/backend_api/Note.html +++ b/docs/backend_api/Note.html @@ -350,7 +350,7 @@
Source:
@@ -535,7 +535,7 @@
Source:
@@ -700,7 +700,7 @@
Source:
@@ -876,7 +876,7 @@
Source:
@@ -980,7 +980,7 @@
Source:
@@ -1080,7 +1080,7 @@
Source:
@@ -1184,7 +1184,7 @@
Source:
@@ -1288,7 +1288,7 @@
Source:
@@ -1388,7 +1388,7 @@
Source:
@@ -1619,7 +1619,7 @@
Source:
@@ -1815,7 +1815,7 @@
Source:
@@ -2011,7 +2011,7 @@
Source:
@@ -2111,7 +2111,7 @@
Source:
@@ -2260,7 +2260,7 @@
Source:
@@ -2425,7 +2425,7 @@
Source:
@@ -2590,7 +2590,7 @@
Source:
@@ -2743,7 +2743,7 @@
Source:
@@ -2851,7 +2851,7 @@
Source:
@@ -2955,7 +2955,7 @@
Source:
@@ -3055,7 +3055,7 @@
Source:
@@ -3155,7 +3155,7 @@
Source:
@@ -3259,7 +3259,7 @@
Source:
@@ -3412,7 +3412,7 @@
Source:
@@ -3577,7 +3577,7 @@
Source:
@@ -3742,7 +3742,7 @@
Source:
@@ -3895,7 +3895,7 @@
Source:
@@ -4051,7 +4051,7 @@
Source:
@@ -4159,7 +4159,7 @@
Source:
@@ -4259,7 +4259,7 @@
Source:
@@ -4367,7 +4367,7 @@
Source:
@@ -4467,7 +4467,7 @@
Source:
@@ -4643,7 +4643,7 @@
Source:
@@ -4747,7 +4747,7 @@
Source:
@@ -4900,7 +4900,7 @@
Source:
@@ -5053,7 +5053,7 @@
Source:
@@ -5162,7 +5162,7 @@ Cache is note instance scoped.
Source:
@@ -5244,7 +5244,7 @@ Cache is note instance scoped.
Source:
@@ -5348,7 +5348,7 @@ Cache is note instance scoped.
Source:
@@ -5452,7 +5452,7 @@ Cache is note instance scoped.
Source:
@@ -5556,7 +5556,7 @@ Cache is note instance scoped.
Source:
@@ -5660,7 +5660,7 @@ Cache is note instance scoped.
Source:
@@ -5764,7 +5764,7 @@ Cache is note instance scoped.
Source:
@@ -5991,7 +5991,7 @@ Cache is note instance scoped.
Source:
@@ -6187,7 +6187,7 @@ Cache is note instance scoped.
Source:
@@ -6383,7 +6383,7 @@ Cache is note instance scoped.
Source:
@@ -6610,7 +6610,7 @@ Cache is note instance scoped.
Source:
@@ -6710,7 +6710,7 @@ Cache is note instance scoped.
Source:
@@ -6810,7 +6810,7 @@ Cache is note instance scoped.
Source:
@@ -7006,7 +7006,7 @@ Cache is note instance scoped.
Source:
@@ -7202,7 +7202,7 @@ Cache is note instance scoped.
Source:
@@ -7460,7 +7460,7 @@ Cache is note instance scoped.
Source:
@@ -7687,7 +7687,7 @@ Cache is note instance scoped.
Source:
@@ -7914,7 +7914,7 @@ Cache is note instance scoped.
Source:
diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.html index c0fe2f8cf..507c6fe89 100644 --- a/docs/backend_api/entities_note.js.html +++ b/docs/backend_api/entities_note.js.html @@ -41,6 +41,8 @@ const LABEL_DEFINITION = 'label-definition'; const RELATION = 'relation'; const RELATION_DEFINITION = 'relation-definition'; +const STRING_MIME_TYPES = ["application/x-javascript"]; + /** * This represents a Note which is a central object in the Trilium Notes project. * @@ -132,7 +134,7 @@ class Note extends Entity { /** @returns {Promise} */ async setJsonContent(content) { - await this.setContent(JSON.stringify(content)); + await this.setContent(JSON.stringify(content, null, '\t')); } /** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */ @@ -160,7 +162,9 @@ class Note extends Entity { /** @returns {boolean} true if the note has string content (not binary) */ isStringNote() { - return ["text", "code", "relation-map", "search"].includes(this.type) || this.mime.startsWith('text/'); + return ["text", "code", "relation-map", "search"].includes(this.type) + || this.mime.startsWith('text/') + || STRING_MIME_TYPES.includes(this.mime); } /** @returns {string} JS script environment - either "frontend" or "backend" */ @@ -709,6 +713,7 @@ class Note extends Entity { delete pojo.isContentAvailable; delete pojo.__attributeCache; delete pojo.titleCipherText; + delete pojo.noteContent; } } diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html index 2782ec98d..cb200a398 100644 --- a/docs/frontend_api/FrontendScriptApi.html +++ b/docs/frontend_api/FrontendScriptApi.html @@ -1292,7 +1292,7 @@
Source:
@@ -1348,6 +1348,110 @@ +

getCurrentNote() → {NoteFull}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ currently loaded note in the editor (HTML, code etc.) +
+ + + +
+
+ Type +
+
+ +NoteFull + + +
+
+ + + + + + + + + + + + +

getCurrentNoteContent() → {string}

@@ -1500,7 +1604,7 @@
Source:
@@ -1915,7 +2019,7 @@ note.
Source:
@@ -2068,7 +2172,7 @@ note.
Source:
@@ -2303,7 +2407,7 @@ note.
Source:
@@ -2719,7 +2823,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -2850,7 +2954,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index 23aa73166..a543684c6 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -232,6 +232,12 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) { */ this.getCurrentNoteContent = noteDetailService.getCurrentNoteContent; + /** + * @method + * @returns {NoteFull} currently loaded note in the editor (HTML, code etc.) + */ + this.getCurrentNote = noteDetailService.getCurrentNote; + /** * This method checks whether user navigated away from the note from which the scripts has been started. * This is necessary because script execution is async and by the time it is finished, the user might have