fix recent notes (db & sync version increase)

This commit is contained in:
zadam
2019-05-21 21:47:28 +02:00
parent ced02b42b5
commit 29828f8e8f
16 changed files with 196 additions and 176 deletions

View File

@@ -44,7 +44,7 @@ import dateNotesService from'./date_notes.js';
* @constructor
* @hideconstructor
*/
function FrontendScriptApi(startNote, currentNote, originEntity = null) {
function FrontendScriptApi(startNote, currentNote, originEntity = null, tabContext = null) {
const $pluginButtons = $("#plugin-buttons");
/** @property {object} note where script started executing */
@@ -57,6 +57,9 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
// to keep consistency with backend API
this.dayjs = dayjs;
/** @property {TabContext|null} - experimental! */
this.tabContext = tabContext;
/**
* Activates note in the tree and in the note detail.
*
@@ -282,12 +285,6 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
*/
this.createNoteLink = linkService.createNoteLink;
/**
* @method
* @returns {string} content of active note (loaded into right pane)
*/
this.getActiveNoteContent = noteDetailService.getActiveNoteContent;
/**
* @method
* @returns {NoteFull} active note (loaded into right pane)
@@ -296,9 +293,13 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
/**
* @method
* @returns {Promise<string>} returns note path of active note
* @returns {Promise<string|null>} returns note path of active note or null if there isn't active note
*/
this.getActiveNotePath = treeService.getActiveNotePath;
this.getActiveNotePath = () => {
const activeTabContext = noteDetailService.getActiveTabContext();
return activeTabContext ? activeTabContext.notePath : null;
};
/**
* This method checks whether user navigated away from the note from which the scripts has been started.