clone: avoid cloning the to-be-purged previous instance of the clone when recreating

This commit is contained in:
jean-emmanuel 2017-08-02 11:03:06 +02:00
parent 7209a64d89
commit af6d9712e9

View file

@ -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) {