From 64d32dcb7508328c4aeb8f539a3e0bb46597b7c2 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Mon, 5 Jun 2017 17:28:01 +0200
Subject: [PATCH] Delete plugin properties when disabling them

---
 Resources/Plugins/edit-design/browser.js | 4 ++--
 Resources/Scripts/plugins.browser.js     | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Resources/Plugins/edit-design/browser.js b/Resources/Plugins/edit-design/browser.js
index 2ffdc881..677f6337 100644
--- a/Resources/Plugins/edit-design/browser.js
+++ b/Resources/Plugins/edit-design/browser.js
@@ -61,7 +61,7 @@ enabled(){
     this.injectDeciderReplyHook(obj && obj.revertReplies);
   };
   
-  if (this.wasLoadedBefore){
+  if (this.$$wasLoadedBefore){
     this.onStageReady();
   }
   else{
@@ -78,7 +78,7 @@ enabled(){
         case "largest": this.defaultConfig.fontSize = "16px"; break;
       }
       
-      this.wasLoadedBefore = true;
+      this.$$wasLoadedBefore = true;
       this.onStageReady();
     });
   }
diff --git a/Resources/Scripts/plugins.browser.js b/Resources/Scripts/plugins.browser.js
index 78c89b0c..a5fd9911 100644
--- a/Resources/Scripts/plugins.browser.js
+++ b/Resources/Scripts/plugins.browser.js
@@ -70,6 +70,12 @@
         else{
           this.disabled.push(plugin.id);
           plugin.obj.disabled();
+          
+          for(let key of Object.keys(plugin.obj)){
+            if (key[0] !== '$'){
+              delete plugin.obj[key];
+            }
+          }
         }
       }
     }