small fixes

This commit is contained in:
zadam
2022-12-22 21:01:52 +01:00
parent 062e8c4b84
commit a882ad41c5
5 changed files with 19 additions and 6 deletions

View File

@@ -371,7 +371,15 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
},
beforeActivate: (event, data) => {
// hidden subtree is hidden hackily, prevent activating it e.g. by keyboard
return hoistedNoteService.getHoistedNoteId() === '_hidden' || data.node.data.noteId !== '_hidden';
if (hoistedNoteService.getHoistedNoteId() === '_hidden') {
// if we're hoisted in hidden subtree, we want to avoid crossing to "visible" tree,
// which could happen via UP key from hidden root (to another top level note)
return data.node.data.noteId === '_hidden' || data.node.getParent().data.noteId !== 'root';
}
// we're not hoisted to hidden subtree, the only way to cross is via DOWN key to the hidden root
return data.node.data.noteId !== '_hidden';
},
activate: async (event, data) => {
// click event won't propagate so let's close context menu manually