From 801c9eba2d308806945af3d83ea05084cbca7fe1 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Mon, 15 May 2017 15:15:34 +0200
Subject: [PATCH] Move edit-design focus/blur events to ready() to avoid errors

---
 Resources/Plugins/edit-design/browser.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Resources/Plugins/edit-design/browser.js b/Resources/Plugins/edit-design/browser.js
index 513b0569..e391f9aa 100644
--- a/Resources/Plugins/edit-design/browser.js
+++ b/Resources/Plugins/edit-design/browser.js
@@ -292,9 +292,6 @@ enabled(){
     }
   };
   
-  $(window).on("focus", this.onWindowFocusEvent);
-  $(window).on("blur", this.onWindowBlurEvent);
-  
   // css and layout injection
   this.resetDesign = () => {
     if (this.css){
@@ -410,6 +407,10 @@ ready(){
   
   this.onAppReady();
   
+  // optimization events
+  $(window).on("focus", this.onWindowFocusEvent);
+  $(window).on("blur", this.onWindowBlurEvent);
+  
   // layout events
   $(document).on("uiShowActionsMenu", this.uiShowActionsMenuEvent);