shortcuts improvements

This commit is contained in:
zadam
2022-11-26 14:57:39 +01:00
parent 6883b71ce7
commit 6a9ac6f90a
9 changed files with 97 additions and 23 deletions

View File

@@ -0,0 +1,27 @@
const cls = require("./cls");
const becca = require("../becca/becca");
function getHoistedNoteId() {
return cls.getHoistedNoteId();
}
function isHoistedInHiddenSubtree() {
const hoistedNoteId = getHoistedNoteId();
if (hoistedNoteId === 'root') {
return false;
}
const hoistedNote = becca.getNote(hoistedNoteId);
if (!hoistedNote) {
throw new Error(`Cannot find hoisted note ${hoistedNoteId}`);
}
return hoistedNote.hasAncestor('hidden');
}
module.exports = {
getHoistedNoteId,
isHoistedInHiddenSubtree
};