X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/038583a188bfecdf9cae22d139116b6a57f7a14d..fea8fda1a2f6a07eac7bb37c3c40a053d398ef92:/src/editor/modules/documentCanvas/canvas/canvas.js
diff --git a/src/editor/modules/documentCanvas/canvas/canvas.js b/src/editor/modules/documentCanvas/canvas/canvas.js
index 97ad592..3a662e9 100644
--- a/src/editor/modules/documentCanvas/canvas/canvas.js
+++ b/src/editor/modules/documentCanvas/canvas/canvas.js
@@ -13,9 +13,9 @@ define([
var Canvas = function(wlxmlDocument, publisher) {
this.eventBus = _.extend({}, Backbone.Events);
this.wrapper = $('
').addClass('canvas-wrapper').attr('contenteditable', true);
+ this.wlxmlListener = wlxmlListener.create(this);
this.loadWlxmlDocument(wlxmlDocument);
this.publisher = publisher ? publisher : function() {};
- this.wlxmlListener = wlxmlListener.create(this);
};
$.extend(Canvas.prototype, {
@@ -33,6 +33,7 @@ $.extend(Canvas.prototype, {
this.setupEventHandling();
this.wlxmlListener.listenTo(wlxmlDocument);
+ this.wlxmlDocument = wlxmlDocument;
},
generateCanvasDOM: function(wlxmlNode) {
@@ -63,6 +64,9 @@ $.extend(Canvas.prototype, {
}
observer.observe(canvas.d[0], config);
canvas.publisher('contentChanged');
+
+ var textElement = canvas.getDocumentElement(mutation.target);
+ textElement.data('wlxmlNode').setText(mutation.target.data);
}
});
});
@@ -264,7 +268,7 @@ $.extend(Canvas.prototype, {
if(params.caretTo || !textElementToLand.sameNode(this.getCursor().getPosition().element))
this._moveCaretToTextElement(textElementToLand, params.caretTo); // as method on element?
if(!(textElementToLand.sameNode(currentTextElement)))
- this.publisher('currentTextElementSet', textElementToLand);
+ this.publisher('currentTextElementSet', textElementToLand.data('wlxmlNode'));
} else {
document.getSelection().removeAllRanges();
}