mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 16:26:31 +01:00
added new APIs to access note detail, #2806
This commit is contained in:
@@ -364,9 +364,27 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
* See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance.
|
||||
*
|
||||
* @method
|
||||
* @param callback - method receiving "textEditor" instance
|
||||
* @param [callback] - deprecated (use returned promise): callback receiving "textEditor" instance
|
||||
* @returns {Promise<CKEditor>} instance of CKEditor
|
||||
*/
|
||||
this.getActiveTabTextEditor = callback => appContext.triggerCommand('executeInActiveEditor', {callback});
|
||||
this.getActiveTabTextEditor = callback => new Promise(resolve => appContext.triggerCommand('executeInActiveTextEditor', {callback, resolve}));
|
||||
|
||||
/**
|
||||
* See https://codemirror.net/doc/manual.html#api
|
||||
*
|
||||
* @method
|
||||
* @returns {Promise<CodeMirror>} instance of CodeMirror
|
||||
*/
|
||||
this.getActiveTabCodeEditor = () => new Promise(resolve => appContext.triggerCommand('executeInActiveCodeEditor', {callback: resolve}));
|
||||
|
||||
/**
|
||||
* Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the
|
||||
* implementation of actual widget type.
|
||||
*
|
||||
* @method
|
||||
* @returns {Promise<NoteDetailWidget>}
|
||||
*/
|
||||
this.getActiveNoteDetailWidget = () => new Promise(resolve => appContext.triggerCommand('executeInActiveNoteDetailWidget', {callback: resolve}));
|
||||
|
||||
/**
|
||||
* @method
|
||||
@@ -374,6 +392,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
*/
|
||||
this.getActiveTabNotePath = () => appContext.tabManager.getActiveContextNotePath();
|
||||
|
||||
/**
|
||||
* Returns component which owns given DOM element (the nearest parent component in DOM tree)
|
||||
*
|
||||
* @method
|
||||
* @param {Element} el - DOM element
|
||||
* @returns {Component}
|
||||
*/
|
||||
this.getComponentByEl = el => appContext.getComponentByEl(el);
|
||||
|
||||
/**
|
||||
* @method
|
||||
* @param {object} $el - jquery object on which to setup the tooltip
|
||||
|
||||
Reference in New Issue
Block a user