mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
context menu converted to module
This commit is contained in:
parent
9880a4d6f6
commit
ad7803f9dc
@ -1,3 +1,4 @@
|
|||||||
|
const contextMenu = (function() {
|
||||||
const treeEl = $("#tree");
|
const treeEl = $("#tree");
|
||||||
|
|
||||||
function pasteAfter(node) {
|
function pasteAfter(node) {
|
||||||
@ -20,7 +21,7 @@ function cut(node) {
|
|||||||
glob.clipboardNoteId = node.key;
|
glob.clipboardNoteId = node.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
const contextMenuSetup = {
|
const contextMenuSettings = {
|
||||||
delegate: "span.fancytree-title",
|
delegate: "span.fancytree-title",
|
||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
menu: [
|
menu: [
|
||||||
@ -84,3 +85,11 @@ const contextMenuSetup = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
pasteAfter,
|
||||||
|
pasteInto,
|
||||||
|
cut,
|
||||||
|
contextMenuSettings
|
||||||
|
}
|
||||||
|
})();
|
@ -161,7 +161,7 @@ const noteTree = (function() {
|
|||||||
console.log("CTRL-V");
|
console.log("CTRL-V");
|
||||||
|
|
||||||
if (event.ctrlKey) { // Ctrl-V
|
if (event.ctrlKey) { // Ctrl-V
|
||||||
pasteAfter(node);
|
contextMenu.pasteAfter(node);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -169,7 +169,7 @@ const noteTree = (function() {
|
|||||||
console.log("CTRL-X");
|
console.log("CTRL-X");
|
||||||
|
|
||||||
if (event.ctrlKey) { // Ctrl-X
|
if (event.ctrlKey) { // Ctrl-X
|
||||||
cut(node);
|
contextMenu.cut(node);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -177,7 +177,7 @@ const noteTree = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
treeEl.contextmenu(contextMenuSetup);
|
treeEl.contextmenu(contextMenu.contextMenuSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadTree() {
|
function loadTree() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user