From 590eea11830531699643b381d06a6a59dd7704bb Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 5 Jan 2022 20:31:21 +0100 Subject: [PATCH] API docs update --- docs/backend_api/ApiToken.html | 4 +- docs/backend_api/Attribute.html | 4 +- docs/backend_api/BackendScriptApi.html | 8 +- docs/backend_api/Branch.html | 8 +- docs/backend_api/Note.html | 124 +- docs/backend_api/NoteRevision.html | 4 +- docs/backend_api/Option.html | 4 +- docs/backend_api/RecentNote.html | 4 +- .../becca_entities_api_token.js.html | 4 +- .../becca_entities_attribute.js.html | 4 +- .../backend_api/becca_entities_branch.js.html | 21 +- docs/backend_api/becca_entities_note.js.html | 11 +- .../becca_entities_note_revision.js.html | 4 +- .../backend_api/becca_entities_option.js.html | 8 +- .../becca_entities_recent_note.js.html | 4 +- docs/backend_api/global.html | 4 +- docs/backend_api/index.html | 4 +- docs/backend_api/module-sql.html | 1267 ----------------- .../services_backend_script_api.js.html | 6 +- docs/backend_api/services_sql.js.html | 35 +- docs/frontend_api/FrontendScriptApi.html | 77 +- docs/frontend_api/NoteShort.html | 292 +++- docs/frontend_api/entities_note_short.js.html | 59 +- .../services_frontend_script_api.js.html | 1 + 24 files changed, 504 insertions(+), 1457 deletions(-) delete mode 100644 docs/backend_api/module-sql.html diff --git a/docs/backend_api/ApiToken.html b/docs/backend_api/ApiToken.html index fd85e3d53..d9539104c 100644 --- a/docs/backend_api/ApiToken.html +++ b/docs/backend_api/ApiToken.html @@ -363,7 +363,9 @@
diff --git a/docs/backend_api/Attribute.html b/docs/backend_api/Attribute.html index f0dd9a7ec..5da2f4475 100644 --- a/docs/backend_api/Attribute.html +++ b/docs/backend_api/Attribute.html @@ -1020,7 +1020,9 @@ and relation (representing named relationship between source and target note)
diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.html index cf1a18ddb..ac1229dcf 100644 --- a/docs/backend_api/BackendScriptApi.html +++ b/docs/backend_api/BackendScriptApi.html @@ -614,7 +614,7 @@ -module:sql +module:sql @@ -5493,7 +5493,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look - if branch will be create between note and parent note, set this prefix + if branch will be created between note and parent note, set this prefix @@ -5913,7 +5913,9 @@ exists, then we'll use that transaction.
diff --git a/docs/backend_api/Branch.html b/docs/backend_api/Branch.html index d29b8e361..b1de020b2 100644 --- a/docs/backend_api/Branch.html +++ b/docs/backend_api/Branch.html @@ -252,7 +252,7 @@ parents.
Source:
@@ -514,7 +514,7 @@ parents.
Source:
@@ -752,7 +752,9 @@ parents.
diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html index cb9c0307f..06bbc8a9d 100644 --- a/docs/backend_api/Note.html +++ b/docs/backend_api/Note.html @@ -1517,7 +1517,7 @@
Source:
@@ -1619,7 +1619,7 @@
Source:
@@ -1721,7 +1721,7 @@
Source:
@@ -1827,7 +1827,7 @@
Source:
@@ -2001,7 +2001,7 @@
Source:
@@ -2201,7 +2201,7 @@
Source:
@@ -2379,7 +2379,7 @@
Source:
@@ -2476,6 +2476,8 @@ +
Deprecated:
+ @@ -2488,7 +2490,7 @@
Source:
@@ -2590,7 +2592,7 @@
Source:
@@ -2692,7 +2694,7 @@
Source:
@@ -2794,7 +2796,7 @@
Source:
@@ -2896,7 +2898,7 @@
Source:
@@ -3004,7 +3006,7 @@
Source:
@@ -3110,7 +3112,7 @@
Source:
@@ -3261,7 +3263,7 @@
Source:
@@ -3431,7 +3433,7 @@
Source:
@@ -3586,7 +3588,7 @@
Source:
@@ -3756,7 +3758,7 @@
Source:
@@ -3862,7 +3864,7 @@
Source:
@@ -4064,7 +4066,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4242,7 +4244,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4400,7 +4402,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4570,7 +4572,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4725,7 +4727,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4895,7 +4897,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5050,7 +5052,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5220,7 +5222,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5375,7 +5377,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5586,7 +5588,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5737,7 +5739,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5907,7 +5909,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6062,7 +6064,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6171,7 +6173,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6280,7 +6282,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6382,7 +6384,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6484,7 +6486,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6586,7 +6588,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6693,7 +6695,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6795,7 +6797,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6946,7 +6948,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7124,7 +7126,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7279,7 +7281,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7434,7 +7436,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7589,7 +7591,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7739,7 +7741,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7845,7 +7847,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7951,7 +7953,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8057,7 +8059,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8163,7 +8165,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8269,7 +8271,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8502,7 +8504,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8682,7 +8684,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8862,7 +8864,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9073,7 +9075,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9253,7 +9255,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9413,7 +9415,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9655,7 +9657,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9866,7 +9868,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10077,7 +10079,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -10123,7 +10125,9 @@ This method can be significantly faster than the getAttribute()
diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.html index 4c5ba9ca9..800f9985c 100644 --- a/docs/backend_api/NoteRevision.html +++ b/docs/backend_api/NoteRevision.html @@ -1290,7 +1290,9 @@ It's used for seamless note versioning.
diff --git a/docs/backend_api/Option.html b/docs/backend_api/Option.html index f0f20a329..d90875d9f 100644 --- a/docs/backend_api/Option.html +++ b/docs/backend_api/Option.html @@ -431,7 +431,9 @@
diff --git a/docs/backend_api/RecentNote.html b/docs/backend_api/RecentNote.html index a03691ba7..31106a6b5 100644 --- a/docs/backend_api/RecentNote.html +++ b/docs/backend_api/RecentNote.html @@ -363,7 +363,9 @@
diff --git a/docs/backend_api/becca_entities_api_token.js.html b/docs/backend_api/becca_entities_api_token.js.html index 62e869de9..a6436cbca 100644 --- a/docs/backend_api/becca_entities_api_token.js.html +++ b/docs/backend_api/becca_entities_api_token.js.html @@ -70,7 +70,9 @@ module.exports = ApiToken;
diff --git a/docs/backend_api/becca_entities_attribute.js.html b/docs/backend_api/becca_entities_attribute.js.html index 2fe091dbd..569206094 100644 --- a/docs/backend_api/becca_entities_attribute.js.html +++ b/docs/backend_api/becca_entities_attribute.js.html @@ -245,7 +245,9 @@ module.exports = Attribute;
diff --git a/docs/backend_api/becca_entities_branch.js.html b/docs/backend_api/becca_entities_branch.js.html index 860191014..474c07967 100644 --- a/docs/backend_api/becca_entities_branch.js.html +++ b/docs/backend_api/becca_entities_branch.js.html @@ -86,6 +86,12 @@ class Branch extends AbstractEntity { } init() { + if (this.branchId) { + this.becca.branches[this.branchId] = this; + } + + this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; + if (this.branchId === 'root') { return; } @@ -104,15 +110,12 @@ class Branch extends AbstractEntity { if (!parentNote.children.includes(childNote)) { parentNote.children.push(childNote); } - - this.becca.branches[this.branchId] = this; - this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; } /** @returns {Note} */ get childNote() { if (!(this.noteId in this.becca.notes)) { - // entities can come out of order in sync, create skeleton which will be filled later + // entities can come out of order in sync/import, create skeleton which will be filled later this.becca.addNote(this.noteId, new Note({noteId: this.noteId})); } @@ -126,7 +129,7 @@ class Branch extends AbstractEntity { /** @returns {Note} */ get parentNote() { if (!(this.parentNoteId in this.becca.notes)) { - // entities can come out of order in sync, create skeleton which will be filled later + // entities can come out of order in sync/import, create skeleton which will be filled later this.becca.addNote(this.parentNoteId, new Note({noteId: this.parentNoteId})); } @@ -164,9 +167,7 @@ class Branch extends AbstractEntity { notePosition: this.notePosition, isExpanded: this.isExpanded, isDeleted: false, - utcDateModified: this.utcDateModified, - // not used for anything, will be later dropped - utcDateCreated: dateUtils.utcNowDateTime() + utcDateModified: this.utcDateModified }; } @@ -192,7 +193,9 @@ module.exports = Branch;
diff --git a/docs/backend_api/becca_entities_note.js.html b/docs/backend_api/becca_entities_note.js.html index a16635153..64d0a4539 100644 --- a/docs/backend_api/becca_entities_note.js.html +++ b/docs/backend_api/becca_entities_note.js.html @@ -164,7 +164,10 @@ class Note extends AbstractEntity { return this.parentBranches; } - /** @returns {Branch[]} */ + /** + * @returns {Branch[]} + * @deprecated use getParentBranches() instead + */ getBranches() { return this.parentBranches; } @@ -1139,7 +1142,7 @@ class Note extends AbstractEntity { const branch = this.becca.getNote(parentNoteId).getParentBranches()[0]; - return cloningService.cloneNoteToParent(this.noteId, branch.branchId); + return cloningService.cloneNoteToBranch(this.noteId, branch.branchId); } decrypt() { @@ -1211,7 +1214,9 @@ module.exports = Note;
diff --git a/docs/backend_api/becca_entities_note_revision.js.html b/docs/backend_api/becca_entities_note_revision.js.html index cd16ba839..6bea60bb8 100644 --- a/docs/backend_api/becca_entities_note_revision.js.html +++ b/docs/backend_api/becca_entities_note_revision.js.html @@ -230,7 +230,9 @@ module.exports = NoteRevision;
diff --git a/docs/backend_api/becca_entities_option.js.html b/docs/backend_api/becca_entities_option.js.html index c9cc7ae32..5c315cf47 100644 --- a/docs/backend_api/becca_entities_option.js.html +++ b/docs/backend_api/becca_entities_option.js.html @@ -65,9 +65,7 @@ class Option extends AbstractEntity { name: this.name, value: this.value, isSynced: this.isSynced, - utcDateModified: this.utcDateModified, - // utcDateCreated is scheduled for removal so the value does not matter - utcDateCreated: dateUtils.utcNowDateTime() + utcDateModified: this.utcDateModified } } } @@ -83,7 +81,9 @@ module.exports = Option;
diff --git a/docs/backend_api/becca_entities_recent_note.js.html b/docs/backend_api/becca_entities_recent_note.js.html index 627f16937..fdf0f598c 100644 --- a/docs/backend_api/becca_entities_recent_note.js.html +++ b/docs/backend_api/becca_entities_recent_note.js.html @@ -69,7 +69,9 @@ module.exports = RecentNote;
diff --git a/docs/backend_api/global.html b/docs/backend_api/global.html index aa443d260..f38d479fe 100644 --- a/docs/backend_api/global.html +++ b/docs/backend_api/global.html @@ -1083,7 +1083,9 @@
diff --git a/docs/backend_api/index.html b/docs/backend_api/index.html index 9c94014d0..6da54a46a 100644 --- a/docs/backend_api/index.html +++ b/docs/backend_api/index.html @@ -50,7 +50,9 @@
diff --git a/docs/backend_api/module-sql.html b/docs/backend_api/module-sql.html deleted file mode 100644 index 1f457e4ce..000000000 --- a/docs/backend_api/module-sql.html +++ /dev/null @@ -1,1267 +0,0 @@ - - - - - JSDoc: Module: sql - - - - - - - - - - -
- -

Module: sql

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(static) execute(query, paramsopt)

- - - - - - -
- Execute SQL -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
query - - -string - - - - - - - - - - SQL query with ? used as parameter placeholder
params - - -Array.<object> - - - - - - <optional>
- - - - - -
array of params if needed
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) getColumn(query, paramsopt) → {Array.<object>}

- - - - - - -
- Get a first column in an array. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
query - - -string - - - - - - - - - - SQL query with ? used as parameter placeholder
params - - -Array.<object> - - - - - - <optional>
- - - - - -
array of params if needed
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- - array of first column of all returned rows -
- - - -
-
- Type -
-
- -Array.<object> - - -
-
- - - - - - - - - - - - - -

(static) getMap(query, paramsopt) → {object}

- - - - - - -
- Get a map of first column mapping to second column. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
query - - -string - - - - - - - - - - SQL query with ? used as parameter placeholder
params - - -Array.<object> - - - - - - <optional>
- - - - - -
array of params if needed
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- - map of first column to second column -
- - - -
-
- Type -
-
- -object - - -
-
- - - - - - - - - - - - - -

(static) getRow(query, paramsopt) → {object}

- - - - - - -
- Get first returned row. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
query - - -string - - - - - - - - - - SQL query with ? used as parameter placeholder
params - - -Array.<object> - - - - - - <optional>
- - - - - -
array of params if needed
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- - map of column name to column value -
- - - -
-
- Type -
-
- -object - - -
-
- - - - - - - - - - - - - -

(static) getRows(query, paramsopt) → {Array.<object>}

- - - - - - -
- Get all returned rows. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
query - - -string - - - - - - - - - - SQL query with ? used as parameter placeholder
params - - -Array.<object> - - - - - - <optional>
- - - - - -
array of params if needed
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- - array of all rows, each row is a map of column name to column value -
- - - -
-
- Type -
-
- -Array.<object> - - -
-
- - - - - - - - - - - - - -

(static) getValue(query, paramsopt)

- - - - - - -
- Get single value from the given query - first column from first returned row. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
query - - -string - - - - - - - - - - SQL query with ? used as parameter placeholder
params - - -Array.<object> - - - - - - <optional>
- - - - - -
array of params if needed
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- [object] - single value -
- - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html index 9c72d1736..59e64a6b0 100644 --- a/docs/backend_api/services_backend_script_api.js.html +++ b/docs/backend_api/services_backend_script_api.js.html @@ -189,7 +189,7 @@ function BackendScriptApi(currentNote, apiParams) { * @param {boolean} present - true if we want the branch to exist, false if we want it gone * @param {string} noteId * @param {string} parentNoteId - * @param {string} prefix - if branch will be create between note and parent note, set this prefix + * @param {string} prefix - if branch will be created between note and parent note, set this prefix * @returns {void} */ this.toggleNoteInParent = cloningService.toggleNoteInParent; @@ -457,7 +457,9 @@ module.exports = BackendScriptApi;
diff --git a/docs/backend_api/services_sql.js.html b/docs/backend_api/services_sql.js.html index 9576eb954..b17d24343 100644 --- a/docs/backend_api/services_sql.js.html +++ b/docs/backend_api/services_sql.js.html @@ -30,6 +30,8 @@ /** * @module sql + * + * TODO: some methods (like getValue()) could use raw rows */ const log = require('./log'); @@ -117,13 +119,7 @@ function getRowOrNull(query, params = []) { } function getValue(query, params = []) { - const row = getRowOrNull(query, params); - - if (!row) { - return null; - } - - return row[Object.keys(row)[0]]; + return wrap(query, s => s.pluck().get(params)); } // smaller values can result in better performance due to better usage of statement cache @@ -172,32 +168,17 @@ function iterateRows(query, params = []) { function getMap(query, params = []) { const map = {}; - const results = getRows(query, params); + const results = getRawRows(query, params); for (const row of results) { - const keys = Object.keys(row); - - map[row[keys[0]]] = row[keys[1]]; + map[row[0]] = row[1]; } return map; } function getColumn(query, params = []) { - const list = []; - const result = getRows(query, params); - - if (result.length === 0) { - return list; - } - - const key = Object.keys(result[0])[0]; - - for (const row of result) { - list.push(row[key]); - } - - return list; + return wrap(query, s => s.pluck().all(params)); } function execute(query, params = []) { @@ -395,7 +376,9 @@ module.exports = {
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html index bc614f7d5..f4e98b4ac 100644 --- a/docs/frontend_api/FrontendScriptApi.html +++ b/docs/frontend_api/FrontendScriptApi.html @@ -1772,7 +1772,7 @@
Source:
@@ -1928,7 +1928,7 @@
Source:
@@ -2172,6 +2172,45 @@ + + + + showNoteIcon + + + + + +boolean + + + + + + + + + <optional>
+ + + + + + + + + + + + false + + + + + show also note icon before the title + + + @@ -2249,7 +2288,7 @@
Source:
@@ -2488,7 +2527,7 @@
Source:
@@ -2594,7 +2633,7 @@
Source:
@@ -2748,7 +2787,7 @@
Source:
@@ -2885,7 +2924,7 @@
Source:
@@ -3147,7 +3186,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3610,7 +3649,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -3765,7 +3804,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -3920,7 +3959,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4357,7 +4396,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4513,7 +4552,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4669,7 +4708,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4806,7 +4845,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4960,7 +4999,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5901,7 +5940,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6052,7 +6091,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6418,7 +6457,7 @@ Typical use case is when new note has been created, we should wait until it is s
Source:
diff --git a/docs/frontend_api/NoteShort.html b/docs/frontend_api/NoteShort.html index be44835e5..178d41f85 100644 --- a/docs/frontend_api/NoteShort.html +++ b/docs/frontend_api/NoteShort.html @@ -1103,7 +1103,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1303,7 +1303,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1481,7 +1481,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1575,6 +1575,8 @@ This note's representation is used in note tree and is kept in Froca. +
Deprecated:
+ @@ -1587,7 +1589,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1677,6 +1679,8 @@ This note's representation is used in note tree and is kept in Froca. +
Deprecated:
+ @@ -1689,7 +1693,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1791,7 +1795,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1893,7 +1897,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1995,7 +1999,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2146,7 +2150,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2313,7 +2317,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2468,7 +2472,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2578,7 +2582,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2752,7 +2756,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2952,7 +2956,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3130,7 +3134,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3285,7 +3289,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3452,7 +3456,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3607,7 +3611,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3762,7 +3766,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3929,7 +3933,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4084,7 +4088,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4142,6 +4146,210 @@ This note's representation is used in note tree and is kept in Froca. +

getParentBranches() → {Array.<Branch>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<Branch> + + +
+
+ + + + + + + + + + + + + +

getParentBranchIds() → {Array.<string>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<string> + + +
+
+ + + + + + + + + + + + +

getParentNoteIds() → {Array.<string>}

@@ -4190,7 +4398,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4292,7 +4500,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4443,7 +4651,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4610,7 +4818,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4765,7 +4973,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4935,7 +5143,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5086,7 +5294,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5192,7 +5400,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5305,7 +5513,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5411,7 +5619,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5513,7 +5721,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5687,7 +5895,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5793,7 +6001,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5944,7 +6152,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6122,7 +6330,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6277,7 +6485,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6432,7 +6640,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6587,7 +6795,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6695,7 +6903,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6779,7 +6987,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6885,7 +7093,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.html index 5e3f31250..f794709cf 100644 --- a/docs/frontend_api/entities_note_short.js.html +++ b/docs/frontend_api/entities_note_short.js.html @@ -158,18 +158,38 @@ class NoteShort { } } - /** @returns {string[]} */ - getBranchIds() { + /** + * @returns {string[]} + */ + getParentBranchIds() { return Object.values(this.parentToBranch); } - /** @returns {Branch[]} */ - getBranches() { + /** + * @returns {string[]} + * @deprecated use getParentBranchIds() instead + */ + getBranchIds() { + return this.getParentBranchIds(); + } + + /** + * @returns {Branch[]} + */ + getParentBranches() { const branchIds = Object.values(this.parentToBranch); return this.froca.getBranches(branchIds); } + /** + * @returns {Branch[]} + * @deprecated use getParentBranches() instead + */ + getBranches() { + return this.getParentBranches(); + } + /** @returns {boolean} */ hasChildren() { return this.children.length > 0; @@ -406,6 +426,9 @@ class NoteShort { else if (this.noteId === 'root') { return "bx bx-chevrons-right"; } + if (this.noteId === 'share') { + return "bx bx-share-alt"; + } else if (this.type === 'text') { if (this.isFolder()) { return "bx bx-folder"; @@ -648,8 +671,8 @@ class NoteShort { }); } - hasAncestor(ancestorNote, visitedNoteIds = null) { - if (this.noteId === ancestorNote.noteId) { + hasAncestor(ancestorNoteId, visitedNoteIds = null) { + if (this.noteId === ancestorNoteId) { return true; } @@ -663,13 +686,13 @@ class NoteShort { visitedNoteIds.add(this.noteId); for (const templateNote of this.getTemplateNotes()) { - if (templateNote.hasAncestor(ancestorNote, visitedNoteIds)) { + if (templateNote.hasAncestor(ancestorNoteId, visitedNoteIds)) { return true; } } for (const parentNote of this.getParentNotes()) { - if (parentNote.hasAncestor(ancestorNote, visitedNoteIds)) { + if (parentNote.hasAncestor(ancestorNoteId, visitedNoteIds)) { return true; } } @@ -786,6 +809,26 @@ class NoteShort { throw new Error(`Unrecognized env type ${env} for note ${this.noteId}`); } } + + isShared() { + for (const parentNoteId of this.parents) { + if (parentNoteId === 'root' || parentNoteId === 'none') { + continue; + } + + const parentNote = froca.notes[parentNoteId]; + + if (!parentNote) { + continue; + } + + if (parentNote.noteId === 'share' || parentNote.isShared()) { + return true; + } + } + + return false; + } } export default NoteShort; diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index 36c0f90d8..04d0bea25 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -341,6 +341,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain * @param {object} [params] * @param {boolean} [params.showTooltip=true] - enable/disable tooltip on the link * @param {boolean} [params.showNotePath=false] - show also whole note's path as part of the link + * @param {boolean} [params.showNoteIcon=false] - show also note icon before the title * @param {string} [title=] - custom link tile with note's title as default */ this.createNoteLink = linkService.createNoteLink;