expose bindGlobalShortcut to frontend script API

This commit is contained in:
zadam
2019-11-05 21:26:54 +01:00
parent a2c78e2c5c
commit 7075842954
6 changed files with 294 additions and 53 deletions

View File

@@ -60,6 +60,8 @@ class NoteShort {
/** @param {string} content-type, e.g. "application/json" */
this.mime = row.mime;
/** @param {boolean} */
this.isDeleted = row.isDeleted;
/** @param {boolean} */
this.archived = row.archived;
/** @param {string} */
this.cssClass = row.cssClass;
@@ -108,7 +110,7 @@ class NoteShort {
const branchIdPos = {};
for (const branchId of Object.values(this.childToBranch)) {
branchIdPos[branchId] = this.treeCache.branches[branchId].notePosition;
branchIdPos[branchId] = this.treeCache.getBranch(branchId).notePosition;
}
this.children.sort((a, b) => branchIdPos[this.childToBranch[a]] < branchIdPos[this.childToBranch[b]] ? -1 : 1);
@@ -153,7 +155,8 @@ class NoteShort {
/** @returns {Promise<Branch[]>} */
async getChildBranches() {
const branchIds = Object.values(this.childToBranch);
// don't use Object.values() to guarantee order
const branchIds = this.children.map(childNoteId => this.childToBranch[childNoteId]);
return this.treeCache.getBranches(branchIds);
}