mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 20:36:13 +01:00
allow search result to be moved from tree to relation map, fixes #1650
This commit is contained in:
@@ -7,6 +7,7 @@ import ws from "./ws.js";
|
||||
|
||||
async function moveBeforeBranch(branchIdsToMove, beforeBranchId) {
|
||||
branchIdsToMove = filterRootNote(branchIdsToMove);
|
||||
branchIdsToMove = filterSearchBranches(branchIdsToMove);
|
||||
|
||||
if (beforeBranchId === 'root') {
|
||||
alert('Cannot move notes before root note.');
|
||||
@@ -25,6 +26,7 @@ async function moveBeforeBranch(branchIdsToMove, beforeBranchId) {
|
||||
|
||||
async function moveAfterBranch(branchIdsToMove, afterBranchId) {
|
||||
branchIdsToMove = filterRootNote(branchIdsToMove);
|
||||
branchIdsToMove = filterSearchBranches(branchIdsToMove);
|
||||
|
||||
const afterNote = await treeCache.getBranch(afterBranchId).getNote();
|
||||
|
||||
@@ -142,6 +144,10 @@ async function moveNodeUpInHierarchy(node) {
|
||||
}
|
||||
}
|
||||
|
||||
function filterSearchBranches(branchIds) {
|
||||
return branchIds.filter(branchId => !branchId.startsWith('virt-'));
|
||||
}
|
||||
|
||||
function filterRootNote(branchIds) {
|
||||
const hoistedNoteId = hoistedNoteService.getHoistedNoteId();
|
||||
|
||||
|
||||
@@ -392,12 +392,6 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||
autoExpandMS: 600,
|
||||
preventLazyParents: false,
|
||||
dragStart: (node, data) => {
|
||||
// don't allow dragging root node
|
||||
if (node.data.noteId === hoistedNoteService.getHoistedNoteId()
|
||||
|| node.getParent().data.noteType === 'search') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const notes = this.getSelectedOrActiveNodes(node).map(node => ({
|
||||
noteId: node.data.noteId,
|
||||
branchId: node.data.branchId,
|
||||
|
||||
Reference in New Issue
Block a user