mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
added "search in subtree" context menu, #534
This commit is contained in:
parent
61e8cbbcba
commit
1f8d382b1f
@ -142,6 +142,12 @@ async function refreshSearch() {
|
|||||||
toastService.showMessage("Saved search note refreshed.");
|
toastService.showMessage("Saved search note refreshed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function searchInSubtree(noteId) {
|
||||||
|
showSearch();
|
||||||
|
|
||||||
|
$searchInput.val(`@in=${noteId} @text*=*`);
|
||||||
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
const hashValue = document.location.hash ? document.location.hash.substr(1) : ""; // strip initial #
|
const hashValue = document.location.hash ? document.location.hash.substr(1) : ""; // strip initial #
|
||||||
|
|
||||||
@ -178,5 +184,6 @@ export default {
|
|||||||
refreshSearch,
|
refreshSearch,
|
||||||
doSearch,
|
doSearch,
|
||||||
init,
|
init,
|
||||||
|
searchInSubtree,
|
||||||
getHelpText: () => helpText
|
getHelpText: () => helpText
|
||||||
};
|
};
|
@ -9,6 +9,7 @@ import hoistedNoteService from './hoisted_note.js';
|
|||||||
import noteDetailService from './note_detail.js';
|
import noteDetailService from './note_detail.js';
|
||||||
import clipboard from './clipboard.js';
|
import clipboard from './clipboard.js';
|
||||||
import protectedSessionHolder from "./protected_session_holder.js";
|
import protectedSessionHolder from "./protected_session_holder.js";
|
||||||
|
import searchNotesService from "./search_notes.js";
|
||||||
|
|
||||||
class TreeContextMenu {
|
class TreeContextMenu {
|
||||||
constructor(node) {
|
constructor(node) {
|
||||||
@ -55,6 +56,8 @@ class TreeContextMenu {
|
|||||||
{ title: "Delete <kbd>Delete</kbd>", cmd: "delete", uiIcon: "trash",
|
{ title: "Delete <kbd>Delete</kbd>", cmd: "delete", uiIcon: "trash",
|
||||||
enabled: isNotRoot && !isHoisted && parentNotSearch },
|
enabled: isNotRoot && !isHoisted && parentNotSearch },
|
||||||
{ title: "----" },
|
{ title: "----" },
|
||||||
|
{ title: "Search in subtree <kbd>Ctrl+Shift+F</kbd>", cmd: "searchInSubtree", uiIcon: "search",
|
||||||
|
enabled: notSearch && noSelectedNotes },
|
||||||
isHoisted ? null : { title: "Hoist note <kbd>Ctrl-H</kbd>", cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes && notSearch },
|
isHoisted ? null : { title: "Hoist note <kbd>Ctrl-H</kbd>", cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes && notSearch },
|
||||||
!isHoisted || !isNotRoot ? null : { title: "Unhoist note <kbd>Ctrl-H</kbd>", cmd: "unhoist", uiIcon: "arrow-up" },
|
!isHoisted || !isNotRoot ? null : { title: "Unhoist note <kbd>Ctrl-H</kbd>", cmd: "unhoist", uiIcon: "arrow-up" },
|
||||||
{ title: "Edit branch prefix <kbd>F2</kbd>", cmd: "editBranchPrefix", uiIcon: "empty",
|
{ title: "Edit branch prefix <kbd>F2</kbd>", cmd: "editBranchPrefix", uiIcon: "empty",
|
||||||
@ -177,6 +180,9 @@ class TreeContextMenu {
|
|||||||
|
|
||||||
treeService.duplicateNote(this.node.data.noteId, branch.parentNoteId);
|
treeService.duplicateNote(this.node.data.noteId, branch.parentNoteId);
|
||||||
}
|
}
|
||||||
|
else if (cmd === "searchInSubtree") {
|
||||||
|
searchNotesService.searchInSubtree(this.node.data.noteId);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
ws.logError("Unknown command: " + cmd);
|
ws.logError("Unknown command: " + cmd);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import treeService from "./tree.js";
|
|||||||
import hoistedNoteService from "./hoisted_note.js";
|
import hoistedNoteService from "./hoisted_note.js";
|
||||||
import clipboard from "./clipboard.js";
|
import clipboard from "./clipboard.js";
|
||||||
import treeCache from "./tree_cache.js";
|
import treeCache from "./tree_cache.js";
|
||||||
|
import searchNoteService from "./search_notes.js";
|
||||||
|
|
||||||
const keyBindings = {
|
const keyBindings = {
|
||||||
"del": node => {
|
"del": node => {
|
||||||
@ -167,6 +168,11 @@ const keyBindings = {
|
|||||||
"down": node => {
|
"down": node => {
|
||||||
node.navigate($.ui.keyCode.DOWN, true).then(treeService.clearSelectedNodes);
|
node.navigate($.ui.keyCode.DOWN, true).then(treeService.clearSelectedNodes);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
"ctrl+shift+f": node => {
|
||||||
|
searchNoteService.searchInSubtree(node.data.noteId);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user