mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 16:56:34 +01:00
add frontend API method openTabWithNote, #1645
This commit is contained in:
@@ -71,6 +71,23 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
appContext.triggerEvent('focusAndSelectTitle');
|
||||
};
|
||||
|
||||
/**
|
||||
* Open a note in a new tab.
|
||||
*
|
||||
* @param {string} notePath (or noteId)
|
||||
* @param {boolean} activate - set to true to activate the new tab, false to stay on the current tab
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
this.openTabWithNote = async (notePath, activate) => {
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
await appContext.tabManager.openTabWithNote(notePath, activate);
|
||||
|
||||
if (activate) {
|
||||
appContext.triggerEvent('focusAndSelectTitle');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {Object} ToolbarButtonOptions
|
||||
* @property {string} title
|
||||
|
||||
Reference in New Issue
Block a user