don't allow deleting hoisted note + other related fixes, closes #488

This commit is contained in:
zadam
2019-04-16 21:40:04 +02:00
parent 3760835608
commit 064a11d872
12 changed files with 66 additions and 54 deletions

View File

@@ -26,8 +26,20 @@ async function unhoist() {
await setHoistedNoteId('root');
}
async function isTopLevelNode(node) {
return await isRootNode(node.getParent());
}
async function isRootNode(node) {
// even though check for 'root' should not be necessary, we keep it just in case
return node.data.noteId === "root"
|| node.data.noteId === await getHoistedNoteId();
}
export default {
getHoistedNoteId,
setHoistedNoteId,
unhoist
unhoist,
isTopLevelNode,
isRootNode
}