mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 16:26:31 +01:00
updated API docs
This commit is contained in:
@@ -95,7 +95,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
this.activateNewNote = async notePath => {
|
||||
await ws.waitForMaxKnownSyncId();
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
await appContext.tabManager.getActiveTabContext().setNote(notePath);
|
||||
appContext.triggerEvent('focusAndSelectTitle');
|
||||
@@ -115,7 +115,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
* @param {ToolbarButtonOptions} opts
|
||||
*/
|
||||
this.addButtonToToolbar = opts => {
|
||||
const buttonId = "toolbar-button-" + opts.title.replace(/[^a-zA-Z0-9]/g, "-");
|
||||
const buttonId = "toolbar-button-" + opts.title.replace(/\s/g, "-");
|
||||
|
||||
const button = $('<button>')
|
||||
.addClass("btn btn-sm")
|
||||
@@ -180,7 +180,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
|
||||
if (ret.success) {
|
||||
// wait until all the changes done in the script has been synced to frontend before continuing
|
||||
await ws.waitForSyncId(ret.maxSyncId);
|
||||
await ws.waitForEntityChangeId(ret.maxEntityChangeId);
|
||||
|
||||
return ret.executionResult;
|
||||
}
|
||||
@@ -197,25 +197,23 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
|
||||
/**
|
||||
* This is a powerful search method - you can search by attributes and their values, e.g.:
|
||||
* "@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
|
||||
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
|
||||
*
|
||||
* @method
|
||||
* @param {string} searchString
|
||||
* @returns {Promise<NoteShort[]>}
|
||||
*/
|
||||
this.searchForNotes = async searchString => {
|
||||
const noteIds = await this.runOnServer(async searchString => {
|
||||
const notes = await api.searchForNotes(searchString);
|
||||
|
||||
return notes.map(note => note.noteId);
|
||||
}, [searchString]);
|
||||
const noteIds = await this.runOnBackend(
|
||||
searchString => api.searchForNotes(searchString).map(note => note.noteId),
|
||||
[searchString]);
|
||||
|
||||
return await treeCache.getNotes(noteIds);
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a powerful search method - you can search by attributes and their values, e.g.:
|
||||
* "@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
|
||||
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
|
||||
*
|
||||
* @method
|
||||
* @param {string} searchString
|
||||
@@ -430,10 +428,18 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
this.waitUntilSynced = ws.waitForMaxKnownSyncId;
|
||||
this.waitUntilSynced = ws.waitForMaxKnownEntityChangeId;
|
||||
|
||||
/**
|
||||
* This will refresh all currently opened notes which have included note specified in the parameter
|
||||
*
|
||||
* @param includedNoteId - noteId of the included note
|
||||
*/
|
||||
this.refreshIncludedNote = includedNoteId => appContext.triggerEvent('refreshIncludedNote', {noteId: includedNoteId});
|
||||
}
|
||||
|
||||
export default FrontendScriptApi;</code></pre>
|
||||
export default FrontendScriptApi;
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@@ -449,7 +455,7 @@ export default FrontendScriptApi;</code></pre>
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
||||
Reference in New Issue
Block a user