mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 16:55:50 +01:00
shortcuts improvements
This commit is contained in:
27
src/services/hoisted_note.js
Normal file
27
src/services/hoisted_note.js
Normal 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
|
||||
};
|
||||
Reference in New Issue
Block a user