if(!view.shownAlready) {\r
view.shownAlready = true;\r
view.selectFirstNode();\r
+ } else if(view.currentNode) {\r
+ view.moveCarretToNode(view.getNodeElement(view.currentNode));\r
}\r
};\r
\r
nodeElement.addClass('rng-module-documentCanvas-currentNode');\r
\r
if(options.moveCarret) {\r
- var range = document.createRange();\r
- range.selectNodeContents(nodeElement[0]);\r
- range.collapse(false);\r
- var selection = document.getSelection();\r
- selection.removeAllRanges()\r
- selection.addRange(range);\r
+ this.moveCarretToNode(nodeElement);\r
}\r
\r
this.currentNode = wlxmlNode;\r
},\r
getNodeElement: function(wlxmlNode) {\r
return this.node.find('#'+wlxmlNode.id);\r
+ },\r
+ moveCarretToNode: function(nodeElement) {\r
+ var range = document.createRange();\r
+ range.selectNodeContents(nodeElement[0]);\r
+ range.collapse(false);\r
+ var selection = document.getSelection();\r
+ selection.removeAllRanges()\r
+ selection.addRange(range);\r
}\r
};\r
\r