From: Aleksander Ɓukasz Date: Thu, 27 Jun 2013 09:00:10 +0000 (+0200) Subject: Integrating new canvas api into rest of the modules X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/f7c97ef38dc00ec9b5358ae0bf959a5e6f99271c?hp=c986f6ebfd3d20bdc75ce00ee09bd2c716e0cb16 Integrating new canvas api into rest of the modules --- diff --git a/modules/documentCanvas/canvas.js b/modules/documentCanvas/canvas.js index c2f6c85..9ae3a53 100644 --- a/modules/documentCanvas/canvas.js +++ b/modules/documentCanvas/canvas.js @@ -11,6 +11,10 @@ define([ var Canvas = function(html) { this.dom = $(template); this.content = this.dom.find('#rng-module-documentCanvas-content'); + this.setHTML(html); +}; + +Canvas.prototype.setHTML = function(html) { if(html) { this.content.html(html); } @@ -38,6 +42,10 @@ Canvas.prototype.findNodes = function(desc) { return toret; }; +Canvas.prototype.getNodeById = function(id) { + return canvasNode.create($(this.content.find('#' +id))); +} + Canvas.prototype.nodeAppend = function(options) { var element; // = $(this.content.find('#' + options.context.id).get(0)); if(options.to === 'root') { @@ -181,10 +189,10 @@ Canvas.prototype.getPrecedingNode = function(options) { }; Canvas.prototype.nodeInsideList = function(options) { - if(options.pointer) { - if(options.pointer.getClass() === 'list-items' || options.pointer.getClass() === 'item') + if(options.node) { + if(options.node.getClass() === 'list-items' || options.node.getClass() === 'item') return true; - var pointerElement = $(this.content.find('#' + options.pointer.getId())); + var pointerElement = $(this.content.find('#' + options.node.getId())); return pointerElement.parents('list-items, item').length > 0; } return false; diff --git a/modules/documentCanvas/canvasManager.js b/modules/documentCanvas/canvasManager.js index 5d17ec0..71c9342 100644 --- a/modules/documentCanvas/canvasManager.js +++ b/modules/documentCanvas/canvasManager.js @@ -1,7 +1,7 @@ define([ 'libs/jquery-1.9.1.min', -'./wlxmlNode' -], function($, wlxmlNode) { +'./canvasNode' +], function($, canvasNode) { 'use strict'; @@ -34,16 +34,16 @@ var Manager = function(canvas, sandbox) { canvas.dom.on('mouseover', '[wlxml-tag]', function(e) { e.stopPropagation(); - manager.sandbox.publish('nodeHovered', new wlxmlNode.Node($(e.target))); + manager.sandbox.publish('nodeHovered', canvasNode.create($(e.target))); }); canvas.dom.on('mouseout', '[wlxml-tag]', function(e) { e.stopPropagation(); - manager.sandbox.publish('nodeBlured', new wlxmlNode.Node($(e.target))); + manager.sandbox.publish('nodeBlured', canvasNode.create($(e.target))); }); canvas.dom.on('click', '[wlxml-tag]', function(e) { e.stopPropagation(); console.log('clicked node type: '+e.target.nodeType); - manager.selectNode(new wlxmlNode.Node($(e.target))); + manager.selectNode(canvasNode.create($(e.target))); }); canvas.dom.on('keyup', '#rng-module-documentCanvas-contentWrapper', function(e) { @@ -53,7 +53,7 @@ var Manager = function(canvas, sandbox) { anchor = anchor.parent(); if(!anchor.is('[wlxml-tag]')) return; - manager.selectNode(new wlxmlNode.Node(anchor)); + manager.selectNode(canvasNode.create(anchor)); }); canvas.dom.on('keydown', '#rng-module-documentCanvas-contentWrapper', function(e) { @@ -79,11 +79,11 @@ var Manager = function(canvas, sandbox) { } }; -Manager.prototype.selectNode = function(wlxmlNode, options) { +Manager.prototype.selectNode = function(cnode, options) { options = options || {}; - var nodeElement = this.getNodeElement(wlxmlNode) + var nodeElement = this.getNodeElement(cnode) - this.dimNode(wlxmlNode); + this.dimNode(cnode); this.canvas.dom.find('.rng-module-documentCanvas-currentNode').removeClass('rng-module-documentCanvas-currentNode'); nodeElement.addClass('rng-module-documentCanvas-currentNode'); @@ -92,8 +92,8 @@ Manager.prototype.selectNode = function(wlxmlNode, options) { this.movecaretToNode(nodeElement, options.movecaret); } - this.currentNode = wlxmlNode; - this.sandbox.publish('nodeSelected', wlxmlNode); + this.currentNode = cnode; + this.sandbox.publish('nodeSelected', cnode); }; Manager.prototype.insertNewNode = function(wlxmlTag, wlxmlClass) { @@ -109,20 +109,24 @@ Manager.prototype.insertNewNode = function(wlxmlTag, wlxmlClass) { offsetStart = offsetEnd; offsetEnd = tmp; } - var node = new wlxmlNode.Node($(selection.anchorNode).parent()); - var newNode = this.canvas.insertNode({place: 'wrapText', context: node, tag: wlxmlTag, klass: wlxmlClass, offsetStart: offsetStart, offsetEnd: offsetEnd}); - this.selectNode(new wlxmlNode.Node(newNode), {movecaret: 'end'}); + var wrapper = canvasNode.create({tag: wlxmlTag, klass: wlxmlClass}); + this.canvas.nodeWrap({inside: canvasNode.create($(selection.anchorNode).parent()), + _with: wrapper, + offsetStart: offsetStart, + offsetEnd: offsetEnd + }); + this.selectNode(wrapper, {movecaret: 'end'}); } } -Manager.prototype.getNodeElement = function(wlxmlNode) { - return this.canvas.dom.find('#'+wlxmlNode.id); +Manager.prototype.getNodeElement = function(cnode) { + return this.canvas.dom.find('#'+cnode.getId()); }; -Manager.prototype.highlightNode = function(wlxmlNode) { - var nodeElement = this.getNodeElement(wlxmlNode); +Manager.prototype.highlightNode = function(cnode) { + var nodeElement = this.getNodeElement(cnode); if(!this.gridToggled) { nodeElement.addClass('rng-common-hoveredNode'); var label = nodeElement.attr('wlxml-tag'); @@ -133,8 +137,8 @@ Manager.prototype.highlightNode = function(wlxmlNode) { } }; -Manager.prototype.dimNode = function(wlxmlNode) { - var nodeElement = this.getNodeElement(wlxmlNode); +Manager.prototype.dimNode = function(cnode) { + var nodeElement = this.getNodeElement(cnode); if(!this.gridToggled) { nodeElement.removeClass('rng-common-hoveredNode'); nodeElement.find('.rng-module-documentCanvas-hoveredNodeTag').remove(); @@ -151,7 +155,7 @@ Manager.prototype.selectFirstNode = function() { else { node = this.canvas.dom.find('[wlxml-class|="p"]') } - this.selectNode(new wlxmlNode.Node(node), {movecaret: true}); + this.selectNode(canvasNode.create(node), {movecaret: true}); }; Manager.prototype.movecaretToNode = function(nodeElement, where) { @@ -175,14 +179,17 @@ Manager.prototype.toggleGrid = function(toggle) { Manager.prototype.onEnterKey = function(e) { e.preventDefault(); var pos = getCursorPosition(); - var insertedNode; + var contextNode = this.canvas.getNodeById(pos.parentNode.attr('id')); + var newNode; + if(pos.isAtEnd) { - insertedNode = this.canvas.insertNode({place: 'after', context: {id: pos.parentNode.attr('id')}, tag: pos.parentNode.attr('wlxml-tag'), klass: pos.parentNode.attr('wlxml-class')}); + newNode = canvasNode.create({tag: pos.parentNode.attr('wlxml-tag'), klass: pos.parentNode.attr('wlxml-class')}); + this.canvas.nodeInsertAfter({node: newNode, after: canvas.getNodeById(pos.parentNode.attr('id'))}); } else { - insertedNode = this.canvas.splitNode({node: {id: pos.parentNode.attr('id')}, textNodeIdx: pos.textNodeIndex, offset: pos.textNodeOffset}); + newNode = this.canvas.nodeSplit({node: contextNode, textNodeIdx: pos.textNodeIndex, offset: pos.textNodeOffset}); } - if(insertedNode.length) - this.selectNode(new wlxmlNode.Node(insertedNode), {movecaret: true}); + if(newNode) + this.selectNode(newNode, {movecaret: true}); this.sandbox.publish('contentChanged'); }; @@ -196,9 +203,9 @@ Manager.prototype.onBackspaceKey = function(e) { } if(len === 0) { e.preventDefault(); - var toRemove = new wlxmlNode.Node(pos.textNode); - var prevNode = this.canvas.getPreviousNode({node:toRemove}); - this.canvas.removeNode({node: toRemove}); // jesli nie ma tekstu, to anchor nie jest tex nodem + var toRemove = canvasNode.create(pos.textNode); + var prevNode = this.canvas.getPrecedingNode({node:toRemove}); + this.canvas.nodeRemove({node: toRemove}); // jesli nie ma tekstu, to anchor nie jest tex nodem this.selectNode(prevNode, {movecaret: 'end'}); } } @@ -207,16 +214,16 @@ Manager.prototype.command = function(command, meta) { var pos = getCursorPosition(); if(command === 'createList') { - var node = new wlxmlNode.Node(pos.parentNode); - if(window.getSelection().getRangeAt().collapsed && this.canvas.insideList({pointer: node})) { - this.canvas.removeList({pointer: node}); + var node = canvasNode.create(pos.parentNode); + if(window.getSelection().getRangeAt().collapsed && this.canvas.nodeInsideList({node: node})) { + this.canvas.listRemove({pointer: node}); this.selectNode(node, {movecaret: 'end'}); this.sandbox.publish('contentChanged'); } else { - if(!this.canvas.insideList({pointer: node})) { - this.canvas.createList({start: new wlxmlNode.Node(pos.parentNode), end: new wlxmlNode.Node(pos.focusNode)}); - this.selectNode(new wlxmlNode.Node(pos.parentNode), {movecaret: 'end'}); + if(!this.canvas.nodeInsideList({node: node})) { + this.canvas.listCreate({start: node, end: canvasNode.create(pos.focusNode)}); + this.selectNode(node, {movecaret: 'end'}); this.sandbox.publish('contentChanged'); } } diff --git a/modules/documentCanvas/canvasNode.js b/modules/documentCanvas/canvasNode.js index 0bfd358..2b108a1 100644 --- a/modules/documentCanvas/canvasNode.js +++ b/modules/documentCanvas/canvasNode.js @@ -2,6 +2,9 @@ define(['libs/jquery-1.9.1.min'], function($) { 'use strict'; + +var tagSelector = '[wlxml-tag]'; + var CanvasNode = function(desc) { if(desc instanceof $) { this.dom = desc; @@ -42,9 +45,34 @@ CanvasNode.prototype.setContent = function(content) { } CanvasNode.prototype.isSame = function(other) { - return this.dom.get(0).isSameNode(other.dom.get(0)); + return (other instanceof CanvasNode) && this.dom.get(0).isSameNode(other.dom.get(0)); } +CanvasNode.prototype.children = function() { + var list = []; + this.dom.children(tagSelector).each(function() { + list.push(new CanvasNode($(this))); + }); + return $(list); +}; + + +CanvasNode.prototype.parent = function() { + var node = this.dom.parent(tagSelector); + if(node.length) + return new CanvasNode(node); + return null; +}; + +CanvasNode.prototype.parents = function() { + var list = []; + this.dom.parents(tagSelector).each(function() { + list.push(new CanvasNode($(this))); + }); + return $(list); +}; + + return { create: function(desc) { return new CanvasNode(desc); diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index bec74fc..a4dcf37 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -3,16 +3,15 @@ define([ 'libs/underscore-min', './transformations', -'./wlxmlNode', './canvas', './canvasManager', -'libs/text!./template.html'], function(_, transformations, wlxmlNode, Canvas, CanvasManager, template) { +'libs/text!./template.html'], function(_, transformations, Canvas, CanvasManager, template) { 'use strict'; return function(sandbox) { - var canvas = new Canvas.Canvas(); + var canvas = Canvas.create(); var manager = new CanvasManager(canvas, sandbox); /* public api */ @@ -22,7 +21,7 @@ return function(sandbox) { return canvas.dom; }, setDocument: function(xml) { - canvas.setXML(xml); + canvas.setHTML(transformations.fromXML.getHTMLTree(xml)); sandbox.publish('documentSet'); }, getDocument: function() { @@ -34,15 +33,15 @@ return function(sandbox) { sandbox.publish('contentChanged'); } }, - highlightNode: function(wlxmlNode) { - manager.highlightNode(wlxmlNode); + highlightNode: function(canvasNode) { + manager.highlightNode(canvasNode); }, - dimNode: function(wlxmlNode) { - manager.dimNode(wlxmlNode); + dimNode: function(canvasNode) { + manager.dimNode(canvasNode); }, - selectNode: function(wlxmlNode) { - if(!wlxmlNode.is(manager.currentNode)) - manager.selectNode(wlxmlNode, {movecaret: true}); + selectNode: function(canvasNode) { + if(!canvasNode.isSame(manager.currentNode)) + manager.selectNode(canvasNode, {movecaret: true}); }, toggleGrid: function(toggle) { manager.toggleGrid(toggle); diff --git a/modules/documentCanvas/documentCanvas.less b/modules/documentCanvas/documentCanvas.less index acfc4c1..94a8b6e 100644 --- a/modules/documentCanvas/documentCanvas.less +++ b/modules/documentCanvas/documentCanvas.less @@ -1,4 +1,4 @@ -@import 'wlxml.less'; +@import 'nodes.less'; #rng-module-documentCanvas { height: 100%; diff --git a/modules/documentCanvas/nodes.less b/modules/documentCanvas/nodes.less new file mode 100644 index 0000000..215d36b --- /dev/null +++ b/modules/documentCanvas/nodes.less @@ -0,0 +1,101 @@ +[wlxml-tag] { + float: none !important; /* temporaty workaround for Bootstrap's influence via [class*="span"] { float: left; } */ + border-color: white; + border-style:solid; + border-width:1px; + min-height:20px; + position:relative; + text-indent: 0; +} + +span[wlxml-tag] { + display:inline-block; + min-width: 10px; +} + +[wlxml-tag=header] { + font-size: 13px; + font-weight: bold; + margin: 10px 0; +} + +[wlxml-tag=section] { + margin-top: 10px; + margin-bottom: 10px; +} + +[wlxml-tag=section] [wlxml-tag=section] { + margin-left:10px; +} + +[wlxml-class|="cite"] { + font-style: italic; +} + +[wlxml-class|="cite-code"] { + font-family: monospace; +} + +[wlxml-class|="cite-code-xml"] { + color: blue; +} + +[wlxml-tag=header] > [wlxml-class=author] { + font-size: 14px; +} + +[wlxml-tag=header] > [wlxml-class=title] { + font-size:18px; +} + +[wlxml-class|="uri"] { + color: blue; + text-decoration: underline; +} + +[wlxml-class|="p"] { + text-indent: 1.5em; +} + +[wlxml-class|="emph-tech"] { + font-style: italic; +} + +[wlxml-tag] metadata { + display:none; +} + +[wlxml-class="list-items"] { + + counter-reset: myitem; + + > [wlxml-class="item"] { + counter-increment: myitem; + display: list-item; + margin-left: 10px; + padding-left: 5px; + + &:before { + content: counter(myitem) '. '; + margin-right:10px; + padding-right:10px; + } + } +} + +[wlxml-class="table"] { + + display: table; + border: 1px solid black; + + [wlxml-class="row"] { + display: table-row; + border: 1px solid black; + } + [wlxml-class="cell"] { + display: table-cell; + border: 1px solid black; + padding: 5px; + } + +} \ No newline at end of file diff --git a/modules/documentCanvas/wlxml.less b/modules/documentCanvas/wlxml.less deleted file mode 100644 index 215d36b..0000000 --- a/modules/documentCanvas/wlxml.less +++ /dev/null @@ -1,101 +0,0 @@ -[wlxml-tag] { - float: none !important; /* temporaty workaround for Bootstrap's influence via [class*="span"] { float: left; } */ - border-color: white; - border-style:solid; - border-width:1px; - min-height:20px; - position:relative; - text-indent: 0; -} - -span[wlxml-tag] { - display:inline-block; - min-width: 10px; -} - -[wlxml-tag=header] { - font-size: 13px; - font-weight: bold; - margin: 10px 0; -} - -[wlxml-tag=section] { - margin-top: 10px; - margin-bottom: 10px; -} - -[wlxml-tag=section] [wlxml-tag=section] { - margin-left:10px; -} - -[wlxml-class|="cite"] { - font-style: italic; -} - -[wlxml-class|="cite-code"] { - font-family: monospace; -} - -[wlxml-class|="cite-code-xml"] { - color: blue; -} - -[wlxml-tag=header] > [wlxml-class=author] { - font-size: 14px; -} - -[wlxml-tag=header] > [wlxml-class=title] { - font-size:18px; -} - -[wlxml-class|="uri"] { - color: blue; - text-decoration: underline; -} - -[wlxml-class|="p"] { - text-indent: 1.5em; -} - -[wlxml-class|="emph-tech"] { - font-style: italic; -} - -[wlxml-tag] metadata { - display:none; -} - -[wlxml-class="list-items"] { - - counter-reset: myitem; - - > [wlxml-class="item"] { - counter-increment: myitem; - display: list-item; - margin-left: 10px; - padding-left: 5px; - - &:before { - content: counter(myitem) '. '; - margin-right:10px; - padding-right:10px; - } - } -} - -[wlxml-class="table"] { - - display: table; - border: 1px solid black; - - [wlxml-class="row"] { - display: table-row; - border: 1px solid black; - } - [wlxml-class="cell"] { - display: table-cell; - border: 1px solid black; - padding: 5px; - } - -} \ No newline at end of file diff --git a/modules/documentCanvas/wlxmlNode.js b/modules/documentCanvas/wlxmlNode.js deleted file mode 100644 index 6bd0c35..0000000 --- a/modules/documentCanvas/wlxmlNode.js +++ /dev/null @@ -1,42 +0,0 @@ -define(['libs/jquery-1.9.1.min'], function($) { - -'use strict'; - -var tagSelector = '[wlxml-tag]'; - -var Node = function(domNode) { - - return { - id: domNode.attr('id'), - tag: domNode.attr('wlxml-tag'), - klass: domNode.attr('wlxml-class'), - parent: function() { - var node = domNode.parent(tagSelector); - if(node.length) - return new Node(node); - return null; - }, - children: function() { - var list = []; - domNode.children(tagSelector).each(function() { - list.push(new Node($(this))); - }); - return $(list); - }, - parents: function() { - var list = []; - domNode.parents(tagSelector).each(function() { - list.push(new Node($(this))); - }); - return $(list); - }, - is: function(wlxmlNode) { - return wlxmlNode && (wlxmlNode.id === this.id); - } - } - -}; - -return { Node: Node} - -}); \ No newline at end of file diff --git a/modules/nodeBreadCrumbs/nodeBreadCrumbs.js b/modules/nodeBreadCrumbs/nodeBreadCrumbs.js index 517f45b..c147c09 100644 --- a/modules/nodeBreadCrumbs/nodeBreadCrumbs.js +++ b/modules/nodeBreadCrumbs/nodeBreadCrumbs.js @@ -32,11 +32,11 @@ return function(sandbox) { this.dom.empty(); var nodes = this.nodes = {}; this.currentNode = node; - this.nodes[node.id] = node; + this.nodes[node.getId()] = node; var parents = node.parents(); parents.each(function() { var parent = this; - nodes[parent.id] = parent; + nodes[parent.getId()] = parent; }); this.dom.html(template({node: node, parents: parents})); }, @@ -54,9 +54,9 @@ return function(sandbox) { return { start: function() { sandbox.publish('ready'); }, getView: function() { return view.dom; }, - setNode: function(wlxmlNode) { - if(!wlxmlNode.is(view.currentNode)) { - view.setNode(wlxmlNode); + setNode: function(canvasNode) { + if(!canvasNode.isSame(view.currentNode)) { + view.setNode(canvasNode); } }, highlightNode: function(id) { view.highlightNode(id); }, diff --git a/modules/nodeBreadCrumbs/template.html b/modules/nodeBreadCrumbs/template.html index e1e9042..2d980c3 100644 --- a/modules/nodeBreadCrumbs/template.html +++ b/modules/nodeBreadCrumbs/template.html @@ -2,9 +2,9 @@ \ No newline at end of file diff --git a/modules/nodeFamilyTree/nodeFamilyTree.js b/modules/nodeFamilyTree/nodeFamilyTree.js index 7415b2d..b5cb56e 100644 --- a/modules/nodeFamilyTree/nodeFamilyTree.js +++ b/modules/nodeFamilyTree/nodeFamilyTree.js @@ -37,26 +37,26 @@ return function(sandbox) { if(parentNode) { parent = { - repr: parentNode.tag + (parentNode.klass ? ' / ' + parentNode.klass : ''), - id: parentNode.id + repr: parentNode.getTag() + (parentNode.getClass() ? ' / ' + parentNode.getClass() : ''), + id: parentNode.getId() }; - this.nodes[parentNode.id] = parentNode; + this.nodes[parentNode.getId()] = parentNode; } var children = []; node.children().each(function() { var child = this; - children.push({repr: child.tag + (child.klass ? ' / ' + child.klass : ''), id: child.id}); - nodes[child.id] = child; + children.push({repr: child.getTag() + (child.getClass() ? ' / ' + child.getClass() : ''), id: child.getId()}); + nodes[child.getId()] = child; }); this.dom.empty(); this.dom.append($(template({parent: parent, children: children}))); }, - highlightNode: function(wlxmlNode) { - this.dom.find('a[data-id="'+wlxmlNode.id+'"]').addClass('rng-common-hoveredNode'); + highlightNode: function(canvasNode) { + this.dom.find('a[data-id="'+canvasNode.getId()+'"]').addClass('rng-common-hoveredNode'); }, - dimNode: function(wlxmlNode) { - this.dom.find('a[data-id="'+wlxmlNode.id+'"]').removeClass('rng-common-hoveredNode'); + dimNode: function(canvasNode) { + this.dom.find('a[data-id="'+canvasNode.getId()+'"]').removeClass('rng-common-hoveredNode'); } } @@ -66,18 +66,18 @@ return function(sandbox) { start: function() { sandbox.publish('ready'); }, - setNode: function(wlxmlNode) { - if(!wlxmlNode.is(view.currentNode)) - view.setNode(wlxmlNode); + setNode: function(canvasNode) { + if(!canvasNode.isSame(view.currentNode)) + view.setNode(canvasNode); }, getView: function() { return view.dom; }, - highlightNode: function(wlxmlNode) { - view.highlightNode(wlxmlNode); + highlightNode: function(canvasNode) { + view.highlightNode(canvasNode); }, - dimNode: function(wlxmlNode) { - view.dimNode(wlxmlNode); + dimNode: function(canvasNode) { + view.dimNode(canvasNode); } }; }; diff --git a/modules/nodePane/nodePane.js b/modules/nodePane/nodePane.js index a9ef9e4..b825b1b 100644 --- a/modules/nodePane/nodePane.js +++ b/modules/nodePane/nodePane.js @@ -24,9 +24,9 @@ return function(sandbox) { getView: function() { return view; }, - setNode: function(node) { - view.find('.rng-module-nodePane-tagSelect').val(node.tag); - view.find('.rng-module-nodePane-classSelect').val(node.klass); + setNode: function(canvasNode) { + view.find('.rng-module-nodePane-tagSelect').val(canvasNode.getTag()); + view.find('.rng-module-nodePane-classSelect').val(canvasNode.getClass()); } } diff --git a/modules/rng/rng.js b/modules/rng/rng.js index a1fe65e..4189902 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -50,23 +50,23 @@ return function(sandbox) { } var commands = { - highlightDocumentNode: function(wlxmlNode, origin) { + highlightDocumentNode: function(canvasNode, origin) { ['documentCanvas', 'nodeBreadCrumbs', 'nodeFamilyTree'].forEach(function(moduleName) { if(!origin || moduleName != origin) - sandbox.getModule(moduleName).highlightNode(wlxmlNode) + sandbox.getModule(moduleName).highlightNode(canvasNode) }); }, - dimDocumentNode: function(wlxmlNode, origin) { + dimDocumentNode: function(canvasNode, origin) { ['documentCanvas', 'nodeBreadCrumbs', 'nodeFamilyTree'].forEach(function(moduleName) { if(!origin || moduleName != origin) - sandbox.getModule(moduleName).dimNode(wlxmlNode) + sandbox.getModule(moduleName).dimNode(canvasNode) }); }, - selectNode: function(wlxmlNode, origin) { - sandbox.getModule('documentCanvas').selectNode(wlxmlNode); - sandbox.getModule('nodePane').setNode(wlxmlNode); - sandbox.getModule('nodeFamilyTree').setNode(wlxmlNode); - sandbox.getModule('nodeBreadCrumbs').setNode(wlxmlNode); + selectNode: function(canvasNode, origin) { + sandbox.getModule('documentCanvas').selectNode(canvasNode); + sandbox.getModule('nodePane').setNode(canvasNode); + sandbox.getModule('nodeFamilyTree').setNode(canvasNode); + sandbox.getModule('nodeBreadCrumbs').setNode(canvasNode); }, resetDocument: function(document, reason) { @@ -191,20 +191,20 @@ return function(sandbox) { dirty.documentCanvas = false; }, - nodeSelected: function(wlxmlNode) { - commands.selectNode(wlxmlNode); + nodeSelected: function(canvasNode) { + commands.selectNode(canvasNode); }, contentChanged: function() { dirty.documentCanvas = true; }, - nodeHovered: function(wlxmlNode) { - commands.highlightDocumentNode(wlxmlNode); + nodeHovered: function(canvasNode) { + commands.highlightDocumentNode(canvasNode); }, - nodeBlured: function(wlxmlNode) { - commands.dimDocumentNode(wlxmlNode); + nodeBlured: function(canvasNode) { + commands.dimDocumentNode(canvasNode); } }; @@ -235,14 +235,14 @@ return function(sandbox) { ready: function() { views.currentNodePaneLayout.appendView(sandbox.getModule('nodeFamilyTree').getView()); }, - nodeEntered: function(wlxmlNode) { - commands.highlightDocumentNode(wlxmlNode, 'nodeFamilyTree'); + nodeEntered: function(canvasNode) { + commands.highlightDocumentNode(canvasNode, 'nodeFamilyTree'); }, - nodeLeft: function(wlxmlNode) { - commands.dimDocumentNode(wlxmlNode, 'nodeFamilyTree'); + nodeLeft: function(canvasNode) { + commands.dimDocumentNode(canvasNode, 'nodeFamilyTree'); }, - nodeSelected: function(wlxmlNode) { - commands.selectNode(wlxmlNode); + nodeSelected: function(canvasNode) { + commands.selectNode(canvasNode); } }; @@ -265,14 +265,14 @@ return function(sandbox) { ready: function() { views.visualEditing.setView('statusBar', sandbox.getModule('nodeBreadCrumbs').getView()); }, - nodeHighlighted: function(wlxmlNode) { - commands.highlightDocumentNode(wlxmlNode, 'nodeBreadCrumbs'); + nodeHighlighted: function(canvasNode) { + commands.highlightDocumentNode(canvasNode, 'nodeBreadCrumbs'); }, - nodeDimmed: function(wlxmlNode) { - commands.dimDocumentNode(wlxmlNode, 'nodeBreadCrumbs'); + nodeDimmed: function(canvasNode) { + commands.dimDocumentNode(canvasNode, 'nodeBreadCrumbs'); }, - nodeSelected: function(wlxmlNode) { - commands.selectNode(wlxmlNode); + nodeSelected: function(canvasNode) { + commands.selectNode(canvasNode); } }