mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
when saving Saved Search or SQL console, move it to their home (i.e. remove from hidden subtree)
This commit is contained in:
@@ -137,7 +137,15 @@ function saveSqlConsole(sqlConsoleNoteId) {
|
||||
attributeService.getNoteWithLabel('sqlConsoleHome')
|
||||
|| dateNoteService.getDateNote(today);
|
||||
|
||||
return sqlConsoleNote.cloneTo(sqlConsoleHome.noteId);
|
||||
const result = sqlConsoleNote.cloneTo(sqlConsoleHome.noteId);
|
||||
|
||||
for (const parentBranch of sqlConsoleNote.getParentBranches()) {
|
||||
if (parentBranch.parentNote.hasAncestor("hidden")) {
|
||||
parentBranch.markAsDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function createSearchNote(searchString, ancestorNoteId) {
|
||||
@@ -158,25 +166,34 @@ function createSearchNote(searchString, ancestorNoteId) {
|
||||
return note;
|
||||
}
|
||||
|
||||
function saveSearchNote(searchNoteId) {
|
||||
const searchNote = becca.getNote(searchNoteId);
|
||||
|
||||
function getSearchHome() {
|
||||
const hoistedNote = getHoistedNote();
|
||||
let searchHome;
|
||||
|
||||
if (!hoistedNote.isRoot()) {
|
||||
searchHome = hoistedNote.searchNoteInSubtree('#hoistedSearchHome')
|
||||
return hoistedNote.searchNoteInSubtree('#hoistedSearchHome')
|
||||
|| hoistedNote.searchNoteInSubtree('#searchHome')
|
||||
|| hoistedNote;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
const today = dateUtils.localNowDate();
|
||||
|
||||
searchHome = hoistedNote.searchNoteInSubtree('#searchHome')
|
||||
return hoistedNote.searchNoteInSubtree('#searchHome')
|
||||
|| dateNoteService.getDateNote(today);
|
||||
}
|
||||
}
|
||||
|
||||
return searchNote.cloneTo(searchHome.noteId);
|
||||
function saveSearchNote(searchNoteId) {
|
||||
const searchNote = becca.getNote(searchNoteId);
|
||||
const searchHome = getSearchHome();
|
||||
|
||||
const result = searchNote.cloneTo(searchHome.noteId);
|
||||
|
||||
for (const parentBranch of searchNote.getParentBranches()) {
|
||||
if (parentBranch.parentNote.hasAncestor("hidden")) {
|
||||
parentBranch.markAsDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getHoistedNote() {
|
||||
|
||||
Reference in New Issue
Block a user