From 8efb20c03e7e5b22ba74d0ae2d343478d5bd8030 Mon Sep 17 00:00:00 2001 From: Niklas Kiefer Date: Tue, 10 Dec 2019 14:19:11 +0100 Subject: [PATCH 1/2] fix(context-pad): do not open replace menu if context pad not open Related to camunda/camunda-modeler#1613 --- .../context-pad/ContextPadProvider.js | 10 +++++--- .../context-pad/ContextPadProviderSpec.js | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/lib/features/context-pad/ContextPadProvider.js b/lib/features/context-pad/ContextPadProvider.js index db6b276b..97a4b157 100644 --- a/lib/features/context-pad/ContextPadProvider.js +++ b/lib/features/context-pad/ContextPadProvider.js @@ -56,9 +56,10 @@ export default function ContextPadProvider( } eventBus.on('create.end', 250, function(event) { - var shape = event.context.shape; + var context = event.context, + shape = context.shape; - if (!hasPrimaryModifier(event)) { + if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) { return; } @@ -423,6 +424,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) { return actions; }; + +// helpers ///////// + function isEventType(eventBo, type, definition) { var isType = eventBo.$instanceOf(type); @@ -436,4 +440,4 @@ function isEventType(eventBo, type, definition) { }); return isType && isDefinition; -} +} \ No newline at end of file diff --git a/test/spec/features/context-pad/ContextPadProviderSpec.js b/test/spec/features/context-pad/ContextPadProviderSpec.js index 96c99e1a..25212549 100644 --- a/test/spec/features/context-pad/ContextPadProviderSpec.js +++ b/test/spec/features/context-pad/ContextPadProviderSpec.js @@ -498,6 +498,31 @@ describe('features - context-pad', function() { } )); + + it('should NOT open replace menu if context pad NOT open', inject( + function(canvas, create, dragging, elementFactory) { + + // given + var rootShape = canvas.getRootElement(), + startEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' }), + task = elementFactory.createShape({ type: 'bpmn:Task' }); + + // when + create.start(canvasEvent({ x: 0, y: 0 }), [ startEvent, task ]); + + dragging.move(canvasEvent({ x: 50, y: 50 })); + dragging.hover({ element: rootShape }); + dragging.move(canvasEvent({ x: 75, y: 75 })); + + dragging.end(canvasEvent({ x: 75, y: 75 }, { ctrlKey: true, metaKey: true })); + + // then + var replaceMenu = domQuery('.bpmn-replace', container); + + expect(replaceMenu).not.to.exist; + } + )); + }); }); From eb5ebfd7bc4e00d37763c32ccfb982af75b72cd9 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Mon, 16 Dec 2019 10:54:53 +0100 Subject: [PATCH 2/2] chore(CHANGELOG): update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68c3bd79..546ab636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to [bpmn-js](https://github.com/bpmn-io/bpmn-js) are documen ___Note:__ Yet to be released changes appear here._ +* `FIX`: do not open replace menu after multi create ([#1255](https://github.com/bpmn-io/bpmn-js/pull/1255)) + ## 6.0.7 * `FIX`: disable waypoints-cropping after pasting connections ([`9f8a724e`](https://github.com/bpmn-io/bpmn-js/commit/9f8a724e9a3ff66bfce14e06ab38066189111a95))