frontend scripts now have startNote, currentNote and targetNote as NoteShort entities which e.g. provides easy access to relations/labels

This commit is contained in:
azivner
2019-01-13 12:16:05 +01:00
parent f7f0560a9f
commit 9268f88bc3
5 changed files with 23 additions and 7 deletions

View File

@@ -1,9 +1,13 @@
import FrontendScriptApi from './frontend_script_api.js';
import utils from './utils.js';
import treeCache from './tree_cache.js';
function ScriptContext(startNote, allNotes, originEntity = null) {
async function ScriptContext(startNoteId, allNoteIds, originEntity = null) {
const modules = {};
const startNote = await treeCache.getNote(startNoteId);
const allNotes = await treeCache.getNotes(allNoteIds);
return {
modules: modules,
notes: utils.toObject(allNotes, note => [note.noteId, note]),