keyboard shortcut ctrl+shift+c for "clone to..." dialog

This commit is contained in:
zadam 2019-11-10 22:19:22 +01:00
parent b53e2a3570
commit 77ac8df1e6
2 changed files with 14 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import linkService from "./link.js";
import zoomService from "./zoom.js";
import protectedSessionService from "./protected_session.js";
import searchNotesService from "./search_notes.js";
import treeService from "./tree.js";
const NOTE_REVISIONS = "../dialogs/note_revisions.js";
const OPTIONS = "../dialogs/options.js";
@ -16,6 +17,7 @@ const HELP = "../dialogs/help.js";
const NOTE_INFO = "../dialogs/note_info.js";
const ABOUT = "../dialogs/about.js";
const LINK_MAP = "../dialogs/link_map.js";
const CLONE_TO = "../dialogs/clone_to.js";
function registerEntrypoints() {
// hot keys are active also inside inputs and content editables
@ -184,6 +186,17 @@ function registerEntrypoints() {
return false;
});
utils.bindGlobalShortcut('ctrl+shift+c', () => import(CLONE_TO).then(d => {
const activeNode = treeService.getActiveNode();
console.log("activeNode", activeNode);
const selectedOrActiveNodes = treeService.getSelectedOrActiveNodes(activeNode);
console.log("selectedOrActiveNodes", selectedOrActiveNodes);
const noteIds = selectedOrActiveNodes.map(node => node.data.noteId);
d.showDialog(noteIds);
}));
}
export default {

View File

@ -64,7 +64,7 @@ class TreeContextMenu {
{ title: "----" },
{ title: "Copy / clone <kbd>Ctrl+C</kbd>", cmd: "copy", uiIcon: "copy",
enabled: isNotRoot },
{ title: "Clone to ...", cmd: "cloneTo", uiIcon: "empty",
{ title: "Clone to ... <kbd>Ctrl+Shift+C</kbd>", cmd: "cloneTo", uiIcon: "empty",
enabled: isNotRoot },
{ title: "Cut <kbd>Ctrl+X</kbd>", cmd: "cut", uiIcon: "cut",
enabled: isNotRoot && !isHoisted && parentNotSearch },