Skip to content

Build your personal knowledge base with Trilium Notes

rename API .createNote() to .createNewNote() to allow future backwards compatibility

zadam6c561b576495
diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.html
index c1b498d326..deed4723a3 100644
--- a/docs/backend_api/BackendScriptApi.html
+++ b/docs/backend_api/BackendScriptApi.html
@@ -543,7 +543,7 @@ the backend.
<div class="description">
Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and
-JSON MIME type. See also createNote() for more options.
+JSON MIME type. See also createNewNote() for more options.
</div>
@@ -736,7 +736,7 @@ JSON MIME type. See also createNote() for more options.
- <h4 class="name" id="createNote"><span class="type-signature"></span>createNote<span class="signature">(params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}>}</span></h4>
+ <h4 class="name" id="createNewNote"><span class="type-signature"></span>createNewNote<span class="signature">(params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}>}</span></h4>
@@ -784,7 +784,7 @@ JSON MIME type. See also createNote() for more options.
<td class="type">
-<span class="param-type"><a href="global.html#CreateNoteParams">CreateNoteParams</a></span>
+<span class="param-type"><a href="global.html#CreateNewNoteParams">CreateNewNoteParams</a></span>
@@ -911,7 +911,7 @@ JSON MIME type. See also createNote() for more options.
<div class="description">
- Create text note. See also createNote() for more options.
+ Create text note. See also createNewNote() for more options.
</div>
diff --git a/docs/backend_api/entities_attribute.js.html b/docs/backend_api/entities_attribute.js.html
index aa9220e396..8a2e0673f4 100644
--- a/docs/backend_api/entities_attribute.js.html
+++ b/docs/backend_api/entities_attribute.js.html
@@ -141,6 +141,7 @@ class Attribute extends Entity {
// cannot be static!
updatePojo(pojo) {
delete pojo.isOwned;
+ delete pojo.__note;
}
}
diff --git a/docs/backend_api/global.html b/docs/backend_api/global.html
index 2221a896e2..907f6a8ca0 100644
--- a/docs/backend_api/global.html
+++ b/docs/backend_api/global.html
@@ -102,7 +102,7 @@
-<h4 class="name" id="CreateNoteAttribute">CreateNoteAttribute</h4>
+<h4 class="name" id="CreateNewNoteParams">CreateNewNoteParams</h4>
@@ -137,8 +137,6 @@
<th>Type</th>
- <th>Attributes</th>
-
@@ -151,7 +149,7 @@
<tr>
- <td class="name"><code>type</code></td>
+ <td class="name"><code>parentNoteId</code></td>
<td class="type">
@@ -164,23 +162,17 @@
</td>
- <td class="attributes">
-
-
- </td>
-
-
- <td class="description last">attribute type - label, relation etc.</td>
+ <td class="description last">MANDATORY</td>
</tr>
<tr>
- <td class="name"><code>name</code></td>
+ <td class="name"><code>title</code></td>
<td class="type">
@@ -193,151 +185,66 @@
</td>
- <td class="attributes">
-
-
-
- </td>
-
- <td class="description last">attribute name</td>
+ <td class="description last">MANDATORY</td>
</tr>
<tr>
- <td class="name"><code>value</code></td>
+ <td class="name"><code>content</code></td>
<td class="type">
<span class="param-type">string</span>
+|
+<span class="param-type">buffer</span>
-
- </td>
- <td class="attributes">
-
- &lt;optional><br>
-
+ </td>
-
- </td>
- <td class="description last">attribute value</td>
+ <td class="description last">MANDATORY</td>
</tr>
- </tbody>
-</table>
-
-
-
-
-<dl class="details">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <dt class="tag-source">Source:</dt>
- <dd class="tag-source"><ul class="dummy"><li>
- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line173">line 173</a>
- </li></ul></dd>
-
-
-
-
-
-
-
-</dl>
-
-
-
-
+ <tr>
+
+ <td class="name"><code>type</code></td>
+
+ <td class="type">
-<h4 class="name" id="CreateNoteParams">CreateNoteParams</h4>
-
-
-
-
+<span class="param-type">string</span>
- <h5>Type:</h5>
- <ul>
- <li>
-<span class="param-type">object</span>
-
-
- </li>
- </ul>
-
-
-
-
-
- <h5 class="subsection-title">Properties:</h5>
-
-
-
-<table class="props">
- <thead>
- <tr>
-
- <th>Name</th>
-
-
- <th>Type</th>
+ </td>
-
+
-
+
- <th class="last">Description</th>
- </tr>
- </thead>
+ <td class="description last">text, code, file, image, search, book, relation-map - MANDATORY</td>
+ </tr>
- <tbody>
<tr>
- <td class="name"><code>parentNoteId</code></td>
+ <td class="name"><code>mime</code></td>
<td class="type">
@@ -353,20 +260,20 @@
- <td class="description last">MANDATORY</td>
+ <td class="description last">value is derived from default mimes for type</td>
</tr>
<tr>
- <td class="name"><code>title</code></td>
+ <td class="name"><code>isProtected</code></td>
<td class="type">
-<span class="param-type">string</span>
+<span class="param-type">boolean</span>
@@ -376,23 +283,20 @@
- <td class="description last">MANDATORY</td>
+ <td class="description last">default is false</td>
</tr>
<tr>
- <td class="name"><code>content</code></td>
+ <td class="name"><code>isExpanded</code></td>
<td class="type">
-<span class="param-type">string</span>
-|
-
-<span class="param-type">buffer</span>
+<span class="param-type">boolean</span>
@@ -402,14 +306,14 @@
- <td class="description last">MANDATORY</td>
+ <td class="description last">default is false</td>
</tr>
<tr>
- <td class="name"><code>type</code></td>
+ <td class="name"><code>prefix</code></td>
<td class="type">
@@ -425,20 +329,20 @@
- <td class="description last">text, code, file, image, search, book, relation-map - MANDATORY</td>
+ <td class="description last">default is empty string</td>
</tr>
<tr>
- <td class="name"><code>mime</code></td>
+ <td class="name"><code>notePosition</code></td>
<td class="type">
-<span class="param-type">string</span>
+<span class="param-type">int</span>
@@ -448,60 +352,142 @@
- <td class="description last">value is derived from default mimes for type</td>
+ <td class="description last">default is last existing notePosition in a parent + 10</td>
</tr>
+ </tbody>
+</table>
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line212">line 212</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
- <tr>
-
- <td class="name"><code>isProtected</code></td>
-
- <td class="type">
-<span class="param-type">boolean</span>
+<h4 class="name" id="CreateNoteAttribute">CreateNoteAttribute</h4>
+
-
- </td>
-
+
+ <h5>Type:</h5>
+ <ul>
+ <li>
+<span class="param-type">object</span>
+
+
+ </li>
+ </ul>
+
- <td class="description last">default is false</td>
- </tr>
+
+
+
+ <h5 class="subsection-title">Properties:</h5>
+<table class="props">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+ <th>Attributes</th>
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
<tr>
- <td class="name"><code>isExpanded</code></td>
+ <td class="name"><code>type</code></td>
<td class="type">
-<span class="param-type">boolean</span>
+<span class="param-type">string</span>
</td>
+ <td class="attributes">
+
+
+
+ </td>
+
- <td class="description last">default is false</td>
+ <td class="description last">attribute type - label, relation etc.</td>
</tr>
<tr>
- <td class="name"><code>prefix</code></td>
+ <td class="name"><code>name</code></td>
<td class="type">
@@ -514,33 +500,47 @@
</td>
+ <td class="attributes">
+
+
+ </td>
- <td class="description last">default is empty string</td>
+
+
+ <td class="description last">attribute name</td>
</tr>
<tr>
- <td class="name"><code>notePosition</code></td>
+ <td class="name"><code>value</code></td>
<td class="type">
-<span class="param-type">int</span>
+<span class="param-type">string</span>
</td>
+ <td class="attributes">
+
+ &lt;optional><br>
+
+
+
+ </td>
+
- <td class="description last">default is last existing notePosition in a parent + 10</td>
+ <td class="description last">attribute value</td>
</tr>
@@ -579,7 +579,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line212">line 212</a>
+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line173">line 173</a>
</li></ul></dd>
diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html
index edc16a6827..de1512b051 100644
--- a/docs/backend_api/services_backend_script_api.js.html
+++ b/docs/backend_api/services_backend_script_api.js.html
@@ -206,7 +206,7 @@ function BackendScriptApi(currentNote, apiParams) {
*/
/**
- * Create text note. See also createNote() for more options.
+ * Create text note. See also createNewNote() for more options.
*
* @param {string} parentNoteId
* @param {string} title
@@ -222,7 +222,7 @@ function BackendScriptApi(currentNote, apiParams) {
/**
* Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and
- * JSON MIME type. See also createNote() for more options.
+ * JSON MIME type. See also createNewNote() for more options.
*
* @param {string} parentNoteId
* @param {string} title
@@ -238,7 +238,7 @@ function BackendScriptApi(currentNote, apiParams) {
});
/**
- * @typedef {object} CreateNoteParams
+ * @typedef {object} CreateNewNoteParams
* @property {string} parentNoteId - MANDATORY
* @property {string} title - MANDATORY
* @property {string|buffer} content - MANDATORY
@@ -253,10 +253,10 @@ function BackendScriptApi(currentNote, apiParams) {
/**
* @method
*
- * @param {CreateNoteParams} [params]
+ * @param {CreateNewNoteParams} [params]
* @returns {Promise&lt;{note: Note, branch: Branch}>} object contains newly created entities note and branch
*/
- this.createNote = noteService.createNewNote;
+ this.createNewNote = noteService.createNewNote;
/**
* Log given message to trilium logs.
diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js
index 08e8890b5a..15953f241e 100644
--- a/src/services/backend_script_api.js
+++ b/src/services/backend_script_api.js
@@ -178,7 +178,7 @@ function BackendScriptApi(currentNote, apiParams) {
*/
/**
- * Create text note. See also createNote() for more options.
+ * Create text note. See also createNewNote() for more options.
*
* @param {string} parentNoteId
* @param {string} title
@@ -194,7 +194,7 @@ function BackendScriptApi(currentNote, apiParams) {
/**
* Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and
- * JSON MIME type. See also createNote() for more options.
+ * JSON MIME type. See also createNewNote() for more options.
*
* @param {string} parentNoteId
* @param {string} title
@@ -210,7 +210,7 @@ function BackendScriptApi(currentNote, apiParams) {
});
/**
- * @typedef {object} CreateNoteParams
+ * @typedef {object} CreateNewNoteParams
* @property {string} parentNoteId - MANDATORY
* @property {string} title - MANDATORY
* @property {string|buffer} content - MANDATORY
@@ -225,10 +225,10 @@ function BackendScriptApi(currentNote, apiParams) {
/**
* @method
*
- * @param {CreateNoteParams} [params]
+ * @param {CreateNewNoteParams} [params]
* @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch
*/
- this.createNote = noteService.createNewNote;
+ this.createNewNote = noteService.createNewNote;
/**
* Log given message to trilium logs.