startNote/currentNote is now accessible on frontend as well

This commit is contained in:
azivner
2018-03-04 23:28:26 -05:00
parent 1c6fc9029f
commit 61c2456cf6
6 changed files with 38 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
function Api() {
function Api(startNote, allNotes) {
const $pluginButtons = $("#plugin-buttons");
async function activateNote(notePath) {
@@ -33,14 +33,19 @@ function Api() {
script = script.toString();
}
const ret = await server.post('script/exec', { script: script, params: prepareParams(params) });
const ret = await server.post('script/exec', {
script: script,
params: prepareParams(params),
startNoteId: startNote.noteId
});
return ret.executionResult;
}
return {
__startNote: startNote,
__notes: toObject(allNotes, note => [note.noteId, note]),
__modules: {},
__notes: {},
addButtonToToolbar,
activateNote,
getInstanceName: noteTree.getInstanceName,