From 77edcf214dfbb6d91757f546bb9736c348068c71 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 26 Jul 2022 13:32:45 +0200 Subject: [PATCH] chg: [workflows:editor] Added duplicate shortcut --- app/View/Elements/Workflows/infoModal.ctp | 22 ++++++++++++++----- app/View/Workflows/editor.ctp | 2 +- .../js/workflows-editor/workflows-editor.js | 16 ++++++++++---- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/View/Elements/Workflows/infoModal.ctp b/app/View/Elements/Workflows/infoModal.ctp index dbffefa4d..3616dbeb2 100644 --- a/app/View/Elements/Workflows/infoModal.ctp +++ b/app/View/Elements/Workflows/infoModal.ctp @@ -123,12 +123,22 @@ $data_passed_to_if_module = [ diff --git a/app/View/Workflows/editor.ctp b/app/View/Workflows/editor.ctp index a25cd86b1..7b67db721 100644 --- a/app/View/Workflows/editor.ctp +++ b/app/View/Workflows/editor.ctp @@ -217,7 +217,7 @@ $isBlockingTrigger = $selectedTrigger['blocking'] ?? false; diff --git a/app/webroot/js/workflows-editor/workflows-editor.js b/app/webroot/js/workflows-editor/workflows-editor.js index c95dfc97e..3fa2f6c61 100644 --- a/app/webroot/js/workflows-editor/workflows-editor.js +++ b/app/webroot/js/workflows-editor/workflows-editor.js @@ -184,6 +184,10 @@ function initDrawflow() { if (evt.keyCode == 46 && $drawflow.is(evt.target)) { deleteSelectedNodes(true) } + if (evt.keyCode == 68 && evt.ctrlKey && $drawflow.is(evt.target)) { + duplicateSelection() + evt.preventDefault() + } }) editor.translate_to = function (x, y) { this.canvas_x = x; @@ -422,10 +426,7 @@ function initDrawflow() { }) $controlDuplicateButton.click(function() { - var currentSelection = selection.getSelection() - var newNodes = duplicateNodesFromHtml(currentSelection) - selection.clearSelection() - selection.select(newNodes) + duplicateSelection() }) $controlDeleteButton.click(function() { deleteSelectedNodes(false) @@ -512,6 +513,13 @@ function saveBlueprint(href) { }) } +function duplicateSelection() { + var currentSelection = selection.getSelection() + var newNodes = duplicateNodesFromHtml(currentSelection) + selection.clearSelection() + selection.select(newNodes) +} + function buildModalForBlock(node_id, block) { var html = genBlockParamHtml(block, false) $blockModal