Skip to content

Build your personal knowledge base with Trilium Notes

CTRL-C CTRL-V now clones the note

azivner0cab4e3eddbf
diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js
index 89676316ca..fdf73e244b 100644
--- a/public/javascripts/context_menu.js
+++ b/public/javascripts/context_menu.js
@@ -15,8 +15,11 @@ const contextMenu = (function() {
else if (clipboardMode === 'copy') {
treeChanges.cloneNoteAfter(clipboardId, node.data.note_tree_id);
}
+ else if (clipboardId === null) {
+ // just do nothing
+ }
else {
- throw new Error("Unrecognized clipboard mode=" + mode);
+ throw new Error("Unrecognized clipboard mode=" + clipboardMode);
}
clipboardId = null;
@@ -127,6 +130,7 @@ const contextMenu = (function() {
pasteAfter,
pasteInto,
cut,
+ copy,
contextMenuSettings
}
})();
\ No newline at end of file
diff --git a/public/javascripts/note_editor.js b/public/javascripts/note_editor.js
index 53593f90ea..fd801e1c82 100644
--- a/public/javascripts/note_editor.js
+++ b/public/javascripts/note_editor.js
@@ -171,9 +171,7 @@ const noteEditor = (function() {
}
$(document).ready(() => {
- noteTitleEl.on('input', () => {
- noteChanged();
- });
+ noteTitleEl.on('input', noteChanged);
noteDetailEl.summernote({
airMode: true,
diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js
index f1dd5ebddc..8188377005 100644
--- a/public/javascripts/note_tree.js
+++ b/public/javascripts/note_tree.js
@@ -435,23 +435,19 @@ const noteTree = (function() {
return false;
// Handle Ctrl-C, -X and -V
- // case 67:
- // if (event.ctrlKey) { // Ctrl-C
- // copyPaste("copy", node);
- // return false;
- // }
- // break;
+ case 67:
+ if (event.ctrlKey) { // Ctrl-C
+ contextMenu.copy(node);
+ return false;
+ }
+ break;
case 86:
- console.log("CTRL-V");
-
if (event.ctrlKey) { // Ctrl-V
contextMenu.pasteAfter(node);
return false;
}
break;
case 88:
- console.log("CTRL-X");
-
if (event.ctrlKey) { // Ctrl-X
contextMenu.cut(node);
return false;