- },\r
- setBody: function(HTMLTree) {\r
- this.node.find('#rng-module-documentCanvas-content').html(HTMLTree);\r
- },\r
- getBody: function() {\r
- return this.node.find('#rng-module-documentCanvas-content').html();\r
- }, \r
- _markSelected: function(node) {\r
- this.dimNode(node);\r
- \r
- this.node.find('.rng-module-documentCanvas-currentNode').removeClass('rng-module-documentCanvas-currentNode');\r
- \r
- node.addClass('rng-module-documentCanvas-currentNode');\r
-\r
- this.currentNode = node;\r
- sandbox.publish('nodeSelected', node);\r
- \r
- },\r
- selectNode: function(node) {\r
- view._markSelected(node);\r
- var range = document.createRange();\r
- range.selectNodeContents(node[0]);\r
- range.collapse(false);\r
-\r
- var selection = document.getSelection();\r
- selection.removeAllRanges()\r
- selection.addRange(range);\r
- },\r
- selectNodeById: function(id) {\r
- var node = this.node.find('#'+id);\r
- if(node)\r
- this.selectNode(node);\r
- },\r
- highlightNode: function(node) {\r
- if(!this.gridToggled) {\r
- node.addClass('rng-hover');\r
- var label = node.attr('wlxml-tag');\r
- if(node.attr('wlxml-class'))\r
- label += ' / ' + node.attr('wlxml-class');\r
- var tag = $('<div>').addClass('rng-module-documentCanvas-hoveredNodeTag').text(label);\r
- node.append(tag);\r
- }\r
- },\r
- dimNode: function(node) {\r
- if(!this.gridToggled) {\r
- node.removeClass('rng-hover');\r
- node.find('.rng-module-documentCanvas-hoveredNodeTag').remove();\r
- }\r
- },\r
- highlightNodeById: function(id) {\r
- var node = this.node.find('#'+id);\r
- if(node)\r
- this.highlightNode(node);\r
- },\r
- dimNodeById: function(id) {\r
- var node = this.node.find('#'+id);\r
- if(node)\r
- this.dimNode(node);\r
- },\r
- selectFirstNode: function() {\r
- var firstNodeWithText = this.node.find('[wlxml-tag]').filter(function() {\r
- return $(this).clone().children().remove().end().text().trim() !== '';\r
- }).first();\r
- var node;\r
- if(firstNodeWithText.length)\r
- node = $(firstNodeWithText[0])\r
- else {\r
- node = this.node.find('[wlxml-class|="p"]')\r
- }\r
- this.selectNode(node);\r
- },\r
- toggleGrid: function(toggle) {\r
- this.node.find('[wlxml-tag]').toggleClass('rng-hover', toggle);\r
- this.gridToggled = toggle;\r