CTRL-X and CTRL-V now cuts and pastes tree nodes

This commit is contained in:
azivner
2017-10-15 20:55:38 -04:00
parent 81187ebb0e
commit a13b4a6f7e
2 changed files with 70 additions and 12 deletions

View File

@@ -1,3 +1,23 @@
function pasteAfter(node) {
const subjectNode = getNodeByKey(globalClipboardNoteId);
moveAfterNode(subjectNode, node);
globalClipboardNoteId = null;
}
function pasteInto(node) {
const subjectNode = getNodeByKey(globalClipboardNoteId);
moveToNode(subjectNode, node);
globalClipboardNoteId = null;
}
function cut(node) {
globalClipboardNoteId = node.key;
}
const contextMenuSetup = {
delegate: "span.fancytree-title",
autoFocus: true,
@@ -46,21 +66,13 @@ const contextMenuSetup = {
decryptSubTree(node.key);
}
else if (ui.cmd === "cut") {
globalClipboardNoteId = node.key;
cut(node);
}
else if (ui.cmd === "pasteAfter") {
const subjectNode = getNodeByKey(globalClipboardNoteId);
moveAfterNode(subjectNode, node);
globalClipboardNoteId = null;
pasteAfter(node);
}
else if (ui.cmd === "pasteInto") {
const subjectNode = getNodeByKey(globalClipboardNoteId);
moveToNode(subjectNode, node);
globalClipboardNoteId = null;
pasteInto(node);
}
else if (ui.cmd === "delete") {
deleteNode(node);