mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 08:46:43 +01:00
using dynamic import for dialogs and widgets to speed up initial load
This commit is contained in:
@@ -35,8 +35,9 @@ import treeCache from './tree_cache.js';
|
||||
import noteDetailService from './note_detail.js';
|
||||
import noteTypeService from './note_type.js';
|
||||
import noteTooltipService from './note_tooltip.js';
|
||||
import protectedSessionService from'./protected_session.js';
|
||||
import dateNotesService from'./date_notes.js';
|
||||
import protectedSessionService from './protected_session.js';
|
||||
import dateNotesService from './date_notes.js';
|
||||
import StandardWidget from '../widgets/standard_widget.js';
|
||||
|
||||
/**
|
||||
* This is the main frontend API interface for scripts. It's published in the local "api" object.
|
||||
@@ -60,6 +61,9 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
/** @property {TabContext|null} - experimental! */
|
||||
this.tabContext = tabContext;
|
||||
|
||||
/** @property {StandardWidget} */
|
||||
this.StandardWidget = StandardWidget;
|
||||
|
||||
/**
|
||||
* Activates note in the tree and in the note detail.
|
||||
*
|
||||
@@ -67,7 +71,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @param {string} notePath (or noteId)
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
this.activateNote = treeService.activateNote;
|
||||
this.activateNote = async (notePath, noteLoadedListener) => {
|
||||
await treeService.activateNote(notePath, async () => {
|
||||
await treeService.scrollToActiveNote();
|
||||
|
||||
if (noteLoadedListener) {
|
||||
noteLoadedListener();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Activates newly created note. Compared to this.activateNote() also refreshes tree.
|
||||
@@ -115,7 +127,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
}
|
||||
|
||||
if (opts.shortcut) {
|
||||
$(document).bind('keydown', opts.shortcut, opts.action);
|
||||
utils.bindGlobalShortcut(opts.shortcut, opts.action);
|
||||
|
||||
button.attr("title", "Shortcut " + opts.shortcut);
|
||||
}
|
||||
@@ -401,7 +413,7 @@ export default FrontendScriptApi;</code></pre>
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a>
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
||||
Reference in New Issue
Block a user