From c8ea3d532e8a081a32838b09cfe268a5b2fa7302 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 11 Jun 2013 10:43:43 +0200 Subject: [PATCH] documentCanvas fix: node now dims correctly --- modules/documentCanvas/documentCanvas.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index e666f0d..55c8d7e 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -32,7 +32,7 @@ return function(sandbox) { this.node.on('click', '[wlxml-tag]', function(e) { e.stopPropagation(); console.log('clicked node type: '+e.target.nodeType); - view._markSelected($(e.target)); + view._markSelected(new wlxmlNode.Node($(e.target))); }); this.node.on('keyup', '#rng-module-documentCanvas-contentWrapper', function(e) { @@ -41,7 +41,7 @@ return function(sandbox) { anchor = anchor.parent(); if(!anchor.is('[wlxml-tag]')) return; - view._markSelected(anchor); + view._markSelected(new wlxmlNode.Node(anchor)); }); this.node.on('keydown', '#rng-module-documentCanvas-contentWrapper', function(e) { @@ -165,19 +165,19 @@ return function(sandbox) { _markSelected: function(node) { this.dimNode(node); + this.node.find('.rng-module-documentCanvas-currentNode').removeClass('rng-module-documentCanvas-currentNode'); - node.addClass('rng-module-documentCanvas-currentNode'); + this.getNodeElement(node).addClass('rng-module-documentCanvas-currentNode'); this.currentNode = node; - sandbox.publish('nodeSelected', new wlxmlNode.Node(node)); + sandbox.publish('nodeSelected', node); }, selectNode: function(node) { - node = this.getNodeElement(node); view._markSelected(node); var range = document.createRange(); - range.selectNodeContents(node[0]); + range.selectNodeContents(this.getNodeElement(node)[0]); range.collapse(false); var selection = document.getSelection(); -- 2.20.1