diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 00815faa1c..726a14bc07 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -163,7 +163,8 @@ define([ "navigationService", "policyService", "dialogService", - "creationService" + "creationService", + "copyService" ], "priority": "mandatory" }, diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 2833f5f357..00dd5bb639 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -132,6 +132,11 @@ define( return false; } + function cancelEditingAfterClone(clonedObject) { + return domainObject.getCapability("editor").cancel() + .then(resolveWith(clonedObject)); + } + // Invoke any save behavior introduced by the editor capability; // this is introduced by EditableDomainObject which is // used to insulate underlying objects from changes made @@ -142,10 +147,9 @@ define( if (!domainObject.getModel().persisted){ return getParent(domainObject) .then(doWizardSave) - .then(copyService.perform.bind( - copyService, - [ domainObject ] - )) + .then(getParent) + .then(copyService.perform.bind(copyService, domainObject)) + .then(cancelEditingAfterClone) .catch(doNothing); } else { return domainObject.getCapability("editor").save()