add keyboard shortcut for duplicate subtree, #1451

This commit is contained in:
zadam 2020-11-23 19:44:49 +01:00
parent 928ed7a034
commit 7d8277699c
2 changed files with 10 additions and 1 deletions

View file

@ -184,6 +184,12 @@ const DEFAULT_KEYBOARD_ACTIONS = [
description: "Add note above to the selection",
scope: "note-tree"
},
{
actionName: "duplicateSubtree",
defaultShortcuts: [],
description: "Duplicate subtree",
scope: "note-tree"
},
{

View file

@ -739,7 +739,10 @@ function duplicateSubtree(origNoteId, newParentNoteId) {
const res = duplicateSubtreeInner(origNote, origBranch, newParentNoteId, noteIdMapping);
res.note.title += " (dup)";
if (!res.note.title.endsWith('(dup)')) {
res.note.title += " (dup)";
}
res.note.save();
return res;