editor: fix - removing redundant event handlers
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 17 Dec 2013 10:50:48 +0000 (11:50 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 17 Dec 2013 10:50:48 +0000 (11:50 +0100)
Handlers on canvas wrapper should be set only once, not with
every document load.

src/editor/modules/documentCanvas/canvas/canvas.js

index 6a60f80..e83029a 100644 (file)
@@ -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.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);
 };
     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.wlxmlListener.listenTo(wlxmlDocument);
         this.wlxmlDocument = wlxmlDocument;
         this.reloadRoot();
-        this.setupEventHandling();
     },
 
     reloadRoot: function() {
     },
 
     reloadRoot: function() {