From ce4cc95ff037cea6359b02b3bf14c83c4f8fdc4e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 10 Oct 2013 16:07:06 +0200 Subject: [PATCH 1/1] wip: storing wlxmlNode-canvasNode references --- .../modules/documentCanvas/canvas/documentElement.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/editor/modules/documentCanvas/canvas/documentElement.js b/src/editor/modules/documentCanvas/canvas/documentElement.js index 374d5c7..cd6b3d8 100644 --- a/src/editor/modules/documentCanvas/canvas/documentElement.js +++ b/src/editor/modules/documentCanvas/canvas/documentElement.js @@ -169,6 +169,9 @@ $.extend(DocumentNodeElement, { var element = this.fromHTMLElement(dom[0], canvas); + element.data('wlxmlNode', wlxmlNode); + wlxmlNode.setData('canvasElement', element); + element.setWlxml({tag: wlxmlNode.getTagName(), klass: wlxmlNode.getClass()}); _.keys(wlxmlNode.getMetaAttributes()).forEach(function(key) { @@ -477,9 +480,12 @@ var DocumentTextElement = function(htmlElement, canvas) { $.extend(DocumentTextElement, { createDOM: function(wlxmlTextNode) { - return $('
') + var dom = $('
') .attr('document-text-element', '') - .text(wlxmlTextNode.getText() || utils.unicode.ZWS); + .text(wlxmlTextNode.getText() || utils.unicode.ZWS), + element = this.fromHTMLElement(dom[0], this); + element.data('wlxmlNode', wlxmlTextNode); + return dom; }, create: function(wlxmlTextNode, canvas) { -- 2.20.1