From 31c6597a1bed5a7770634f6162e8f3f3b56876af Mon Sep 17 00:00:00 2001 From: AFaust Date: Sun, 19 Feb 2017 23:41:07 +0100 Subject: [PATCH] Add destroyOnHide for DialogService pubSub payloads --- .../main/resources/alfresco/services/DialogService.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/aikau/src/main/resources/alfresco/services/DialogService.js b/aikau/src/main/resources/alfresco/services/DialogService.js index d85f05b3ab..4d84ca2271 100644 --- a/aikau/src/main/resources/alfresco/services/DialogService.js +++ b/aikau/src/main/resources/alfresco/services/DialogService.js @@ -156,6 +156,7 @@ * @property {object} [customFormConfig=null] Any additional configuration that can be applied to a [Form]{@link module:alfresco/forms/Form} (please note that the following form configuration * attributes will always be overridden by specific form dialog configuration: "additionalCssClasses", "displayButtons", "widgets", "value", "warnings" and "warningsPosition") * @property {boolean} [noMinWidth=false] Indicates whether the minimum width restriction should be lifted + * @property {boolean} [destroyOnHide=false] Indicates the dialog should be completely torn down and its widgets destroyed immediately after being hidden. */ /** @@ -177,6 +178,7 @@ * @property {boolean} [fullScreenMode=false] Whether or not to create the dialog the size of the screen * @property {boolean} [fullScreenPadding=10] The padding to leave around the dialog when in full screen mode * @property {boolean} [noMinWidth=false] Indicates whether the minimum width restriction should be lifted + * @property {boolean} [destroyOnHide=false] Indicates the dialog should be completely torn down and its widgets destroyed immediately after being hidden. */ define(["dojo/_base/declare", @@ -955,10 +957,15 @@ define(["dojo/_base/declare", }); // If there are no dialogs "left" then set the dialogs-showing CSS state to "false" - if(this._activeDialogs.length === 0) { + if (this._activeDialogs.length === 0) { domClass.remove(document.documentElement, "alfresco-dialog-AlfDialog--dialogs-visible"); domStyle.set(document.body, "margin-right", "0"); } + + // If the request payload specified destroyOnHide do the cleanup early + if (payload.destroyOnHide) { + this.cleanUpAnyPreviousDialog(payload); + } })); },