From: Aleksander Ɓukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Date: Tue, 17 Dec 2013 10:50:48 +0000 (+0100)
Subject: editor: fix - removing redundant event handlers
X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/ab6fa141d7c0d032ef01c04f657e84349e27968a

editor: fix - removing redundant event handlers

Handlers on canvas wrapper should be set only once, not with
every document load.
---

diff --git a/src/editor/modules/documentCanvas/canvas/canvas.js b/src/editor/modules/documentCanvas/canvas/canvas.js
index 6a60f80..e83029a 100644
--- a/src/editor/modules/documentCanvas/canvas/canvas.js
+++ b/src/editor/modules/documentCanvas/canvas/canvas.js
@@ -52,6 +52,7 @@ var Canvas = function(wlxmlDocument, publisher) {
     this.wrapper = $('<div>').addClass('canvas-wrapper').attr('contenteditable', true);
     this.wlxmlListener = wlxmlListener.create(this);
     this.loadWlxmlDocument(wlxmlDocument);
+    this.setupEventHandling();
     this.publisher = publisher ? publisher : function() {};
     this.textHandler = new TextHandler(this);
 };
@@ -66,7 +67,6 @@ $.extend(Canvas.prototype, {
         this.wlxmlListener.listenTo(wlxmlDocument);
         this.wlxmlDocument = wlxmlDocument;
         this.reloadRoot();
-        this.setupEventHandling();
     },
 
     reloadRoot: function() {