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

@ -32,7 +32,7 @@ UPDATE notes SET noteId = '_hidden' WHERE noteId = 'hidden';
UPDATE note_contents SET noteId = '_hidden' WHERE noteId = 'hidden';
UPDATE note_revisions SET noteId = '_hidden' WHERE noteId = 'hidden';
UPDATE branches SET noteId = '_hidden' WHERE noteId = 'hidden';
UPDATE branches SET branchId = '_hidden' WHERE branchId = 'hidden';
UPDATE branches SET branchId = '_hidden', prefix = NULL WHERE branchId = 'hidden';
UPDATE branches SET parentNoteId = '_hidden' WHERE parentNoteId = 'hidden';
UPDATE attributes SET noteId = '_hidden' WHERE noteId = 'hidden';
UPDATE attributes SET value = '_hidden' WHERE type = 'relation' AND value = 'hidden';

View file

@ -1 +1,3 @@
<p>Hidden tree is used to record various application-level data which can stay most of the time hidden from the user view.</p>
<p>Make sure you know what you're doing. Incorrect changes in this subtree might potentially crash the application.</p>

View file

@ -0,0 +1 @@
<p>This note serves as a subtree reserved for data produced by user scripts which should otherwise not freely create data in the hidden subtree.</p>

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

View file

@ -20,7 +20,8 @@ const HIDDEN_SUBTREE_DEFINITION = {
// over tree when it's in the middle
notePosition: 999_999_999,
attributes: [
{ type: 'label', name: 'excludeFromNoteMap', isInheritable: true }
{ type: 'label', name: 'excludeFromNoteMap', isInheritable: true },
{ type: 'label', name: 'docName', value: 'hidden' }
],
children: [
{
@ -47,7 +48,7 @@ const HIDDEN_SUBTREE_DEFINITION = {
id: '_share',
title: 'Shared Notes',
type: 'doc',
attributes: [ { type: 'label', name: 'docName', value: '_share' } ]
attributes: [ { type: 'label', name: 'docName', value: 'share' } ]
},
{
id: '_bulkAction',
@ -67,7 +68,8 @@ const HIDDEN_SUBTREE_DEFINITION = {
// place for user scripts hidden stuff (scripts should not create notes directly under hidden root)
id: '_userHidden',
title: 'User Hidden',
type: 'text',
type: 'doc',
attributes: [ { type: 'label', name: 'docName', value: 'user_hidden' } ]
},
{
id: LBTPL_ROOT,