var view = {\r
node: $(_.template(template)()),\r
currentNode: null,\r
+ shownAlready: false,\r
setup: function() {\r
var view = this;\r
\r
view.insertNewNode(null, null);\r
}\r
});\r
+ \r
+ this.node.onShow = function() {\r
+ if(!view.shownAlready) {\r
+ view.shownAlready = true;\r
+ view.selectFirstNode();\r
+ }\r
+ };\r
+ \r
this.gridToggled = false;\r
},\r
_createNode: function(wlxmlTag, wlxmlClass) {\r
else {\r
node = this.node.find('[wlxml-class|="p"]')\r
}\r
- this.selectNode(new wlxmlNode.Node(node));\r
+ this.selectNode(new wlxmlNode.Node(node), {moveCarret: true});\r
},\r
toggleGrid: function(toggle) {\r
this.node.find('[wlxml-tag]').toggleClass('rng-common-hoveredNode', toggle);\r
setDocument: function(xml) {\r
var transformed = transformations.fromXML.getDocumentDescription(xml);\r
view.setBody(transformed.HTMLTree);\r
- view.selectFirstNode();\r
sandbox.publish('documentSet');\r
},\r
getDocument: function() {\r
if(this.selectedTab)\r
this.contents[this.selectedTab].detach();\r
this.nodes.content.append(this.contents[slug]);\r
+ if(this.contents[slug].onShow) {\r
+ this.contents[slug].onShow();\r
+ }\r
this.nodes.tabBar.find('.active').removeClass('active');\r
this.nodes.tabBar.find('a[href="#'+slug+'"]').parent().addClass('active');\r
\r