'libs/backbone',
'modules/documentCanvas/canvas/documentElement',
'modules/documentCanvas/canvas/keyboard',
-'modules/documentCanvas/canvas/utils'
-], function($, _, Backbone, documentElement, keyboard, utils) {
+'modules/documentCanvas/canvas/utils',
+'modules/documentCanvas/canvas/wlxmlListener'
+], function($, _, Backbone, documentElement, keyboard, utils, wlxmlListener) {
'use strict';
var Canvas = function(wlxmlDocument, publisher) {
this.eventBus = _.extend({}, Backbone.Events);
this.wrapper = $('<div>').addClass('canvas-wrapper').attr('contenteditable', true);
+ this.wlxmlListener = wlxmlListener.create(this);
this.loadWlxmlDocument(wlxmlDocument);
this.publisher = publisher ? publisher : function() {};
};
if(!wlxmlDocument) {
return false;
}
+
var canvasDOM = this.generateCanvasDOM(wlxmlDocument.root);
this.wrapper.empty();
this.wrapper.append(canvasDOM);
this.d = this.wrapper.children(0);
this.setupEventHandling();
+
+ this.wlxmlListener.listenTo(wlxmlDocument);
},
generateCanvasDOM: function(wlxmlNode) {
-
var element = documentElement.DocumentNodeElement.create(wlxmlNode, this);
-
-
return element.dom();
},
if(!(currentNodeElement && currentNodeElement.sameNode(nodeElementToLand))) {
_markAsCurrent(nodeElementToLand);
- this.publisher('currentNodeElementSet', nodeElementToLand);
+ this.publisher('currentNodeElementSet', nodeElementToLand.data('wlxmlNode'));
}
},