From af6d9712e9537715b53a0afb330e2ac827aad63f Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 2 Aug 2017 11:03:06 +0200 Subject: [PATCH] clone: avoid cloning the to-be-purged previous instance of the clone when recreating --- src/browser/js/app/widgets/containers/clone.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/browser/js/app/widgets/containers/clone.js b/src/browser/js/app/widgets/containers/clone.js index 180857ec..1a8981bb 100644 --- a/src/browser/js/app/widgets/containers/clone.js +++ b/src/browser/js/app/widgets/containers/clone.js @@ -47,8 +47,9 @@ module.exports = class Clone extends _widgets_base { $('body').on(`widget-created.${this.hash}`, (e)=>{ var {id, hash} = e - if ((id == this.getProp('widgetId') && this.cloneHash.indexOf(hash) == -1) || - (widgetManager.widgets[this.originalHash] && widgetManager.widgets[this.originalHash].hashes && widgetManager.widgets[this.originalHash].hashes.indexOf(hash) != -1) + if ((id == this.getProp('widgetId') && this.cloneHash.indexOf(hash) == -1) + // || + // (widgetManager.widgets[this.originalHash] && widgetManager.widgets[this.originalHash].hashes && widgetManager.widgets[this.originalHash].hashes.indexOf(hash) != -1) ) { this.createClone() } @@ -72,7 +73,7 @@ module.exports = class Clone extends _widgets_base { if (widgets.length) { - for (var i in widgets) { + for (var i = widgets.length - 1; i>=0; i--) { if (this.cloneHash.indexOf(widgets[i].hash) == -1) {