2022-11-26 14:57:39 +01:00
|
|
|
const cls = require("./cls");
|
|
|
|
const becca = require("../becca/becca");
|
|
|
|
|
|
|
|
function getHoistedNoteId() {
|
|
|
|
return cls.getHoistedNoteId();
|
|
|
|
}
|
|
|
|
|
|
|
|
function isHoistedInHiddenSubtree() {
|
|
|
|
const hoistedNoteId = getHoistedNoteId();
|
|
|
|
|
|
|
|
if (hoistedNoteId === 'root') {
|
|
|
|
return false;
|
2022-12-21 16:11:00 +01:00
|
|
|
} else if (hoistedNoteId === '_hidden') {
|
2022-12-16 16:00:49 +01:00
|
|
|
return true;
|
2022-11-26 14:57:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const hoistedNote = becca.getNote(hoistedNoteId);
|
|
|
|
|
|
|
|
if (!hoistedNote) {
|
|
|
|
throw new Error(`Cannot find hoisted note ${hoistedNoteId}`);
|
|
|
|
}
|
|
|
|
|
2022-12-21 16:11:00 +01:00
|
|
|
return hoistedNote.hasAncestor('_hidden');
|
2022-11-26 14:57:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
getHoistedNoteId,
|
|
|
|
isHoistedInHiddenSubtree
|
|
|
|
};
|