allow search result to be moved from tree to relation map, fixes #1650

This commit is contained in:
zadam
2021-02-18 22:30:55 +01:00
parent 859465841d
commit 2cfd093cae
4 changed files with 22 additions and 14 deletions

View File

@@ -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();

View File

@@ -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,