mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 08:16:40 +01:00
updated API docs
This commit is contained in:
@@ -38,8 +38,8 @@ import searchService from './search.js';
|
||||
import CollapsibleWidget from '../widgets/collapsible_widget.js';
|
||||
import ws from "./ws.js";
|
||||
import appContext from "./app_context.js";
|
||||
import TabAwareWidget from "../widgets/tab_aware_widget.js";
|
||||
import TabCachingWidget from "../widgets/tab_caching_widget.js";
|
||||
import NoteContextAwareWidget from "../widgets/note_context_aware_widget.js";
|
||||
import NoteContextCachingWidget from "../widgets/note_context_caching_widget.js";
|
||||
import BasicWidget from "../widgets/basic_widget.js";
|
||||
|
||||
/**
|
||||
@@ -67,11 +67,23 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
/** @property {CollapsibleWidget} */
|
||||
this.CollapsibleWidget = CollapsibleWidget;
|
||||
|
||||
/** @property {TabAwareWidget} */
|
||||
this.TabAwareWidget = TabAwareWidget;
|
||||
/**
|
||||
* @property {NoteContextAwareWidget}
|
||||
* @deprecated use NoteContextAwareWidget instead
|
||||
*/
|
||||
this.TabAwareWidget = NoteContextAwareWidget;
|
||||
|
||||
/** @property {TabCachingWidget} */
|
||||
this.TabCachingWidget = TabCachingWidget;
|
||||
/** @property {NoteContextAwareWidget} */
|
||||
this.NoteContextAwareWidget = NoteContextAwareWidget;
|
||||
|
||||
/**
|
||||
* @property {NoteContextCachingWidget}
|
||||
* @deprecated use NoteContextCachingWidget instead
|
||||
*/
|
||||
this.TabCachingWidget = NoteContextCachingWidget;
|
||||
|
||||
/** @property {NoteContextAwareWidget} */
|
||||
this.NoteContextCachingWidget = NoteContextCachingWidget;
|
||||
|
||||
/** @property {BasicWidget} */
|
||||
this.BasicWidget = BasicWidget;
|
||||
@@ -84,7 +96,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
this.activateNote = async notePath => {
|
||||
await appContext.tabManager.getActiveTabContext().setNote(notePath);
|
||||
await appContext.tabManager.getActiveContext().setNote(notePath);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -96,7 +108,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
this.activateNewNote = async notePath => {
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
await appContext.tabManager.getActiveTabContext().setNote(notePath);
|
||||
await appContext.tabManager.getActiveContext().setNote(notePath);
|
||||
appContext.triggerEvent('focusAndSelectTitle');
|
||||
};
|
||||
|
||||
@@ -110,7 +122,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
this.openTabWithNote = async (notePath, activate) => {
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
await appContext.tabManager.openTabWithNote(notePath, activate);
|
||||
await appContext.tabManager.openContextWithNote(notePath, activate);
|
||||
|
||||
if (activate) {
|
||||
appContext.triggerEvent('focusAndSelectTitle');
|
||||
@@ -140,19 +152,23 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
.on('click', () => {
|
||||
setTimeout(() => $pluginButtons.dropdown('hide'), 0);
|
||||
});
|
||||
|
||||
if (opts.icon) {
|
||||
button.append($("<span>").addClass("bx bx-" + opts.icon))
|
||||
.append("&nbsp;");
|
||||
}
|
||||
|
||||
button.append($("<span>").text(opts.title));
|
||||
} else {
|
||||
button = $('<button class="noborder">')
|
||||
.addClass("btn btn-sm");
|
||||
button = $('<span class="button-widget icon-action bx" data-toggle="tooltip" title="" data-placement="right"></span>')
|
||||
.addClass("bx bx-" + (opts.icon || "question-mark"));
|
||||
|
||||
button.attr("title", opts.title);
|
||||
button.tooltip({html: true});
|
||||
}
|
||||
|
||||
button = button.on('click', opts.action);
|
||||
|
||||
if (opts.icon) {
|
||||
button.append($("<span>").addClass("bx bx-" + opts.icon))
|
||||
.append("&nbsp;");
|
||||
}
|
||||
|
||||
button.append($("<span>").text(opts.title));
|
||||
|
||||
button.attr('id', buttonId);
|
||||
|
||||
if ($("#" + buttonId).replaceWith(button).length === 0) {
|
||||
@@ -341,7 +357,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
* @method
|
||||
* @returns {NoteShort} active note (loaded into right pane)
|
||||
*/
|
||||
this.getActiveTabNote = () => appContext.tabManager.getActiveTabNote();
|
||||
this.getActiveTabNote = () => appContext.tabManager.getActiveContextNote();
|
||||
|
||||
/**
|
||||
* See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance.
|
||||
@@ -355,7 +371,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
* @method
|
||||
* @returns {Promise<string|null>} returns note path of active note or null if there isn't active note
|
||||
*/
|
||||
this.getActiveTabNotePath = () => appContext.tabManager.getActiveTabNotePath();
|
||||
this.getActiveTabNotePath = () => appContext.tabManager.getActiveContextNotePath();
|
||||
|
||||
/**
|
||||
* @method
|
||||
@@ -368,7 +384,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
* @method
|
||||
*/
|
||||
this.protectActiveNote = async () => {
|
||||
const activeNote = appContext.tabManager.getActiveTabNote();
|
||||
const activeNote = appContext.tabManager.getActiveContextNote();
|
||||
|
||||
await protectedSessionService.protectNote(activeNote.noteId, true, false);
|
||||
};
|
||||
@@ -434,10 +450,10 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
* @return {Promise}
|
||||
*/
|
||||
this.setHoistedNoteId = (noteId) => {
|
||||
const activeTabContext = appContext.tabManager.getActiveTabContext();
|
||||
const activeNoteContext = appContext.tabManager.getActiveContext();
|
||||
|
||||
if (activeTabContext) {
|
||||
activeTabContext.setHoistedNoteId(noteId);
|
||||
if (activeNoteContext) {
|
||||
activeNoteContext.setHoistedNoteId(noteId);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -487,13 +503,13 @@ export default FrontendScriptApi;
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#decorateWidget">decorateWidget</a></li><li><a href="global.html#doRenderBody">doRenderBody</a></li><li><a href="global.html#widgetCollapsedStateChangedEvent">widgetCollapsedStateChangedEvent</a></li></ul>
|
||||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a>
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
||||
Reference in New Issue
Block a user