+Manager.prototype.insertNewNode = function(wlxmlTag, wlxmlClass) {\r
+ var selection = window.getSelection(),\r
+ $anchorNode = $(selection.anchorNode),\r
+ $focusNode = $(selection.focusNode);\r
+ \r
+ \r
+ if(!selection.isCollapsed && $anchorNode.parent()[0] === $focusNode.parent()[0]) {\r
+ var textNodeIdx,\r
+ parent = $anchorNode.parent(),\r
+ parentContents = parent.contents(),\r
+ offsetStart = selection.anchorOffset,\r
+ offsetEnd = selection.focusOffset;\r
+ \r
+ if(selection.anchorNode === selection.focusNode) {\r
+ if(offsetStart > offsetEnd) {\r
+ var tmp = offsetStart;\r
+ offsetStart = offsetEnd;\r
+ offsetEnd = tmp;\r
+ }\r
+ textNodeIdx = parentContents.index($anchorNode);\r
+ } else {\r
+ if(parentContents.index($anchorNode) > parentContents.index($focusNode)) {\r
+ offsetStart = selection.focusOffset;\r
+ offsetEnd = selection.anchorOffset;\r
+ }\r
+ textNodeIdx = [parentContents.index($anchorNode), parentContents.index($focusNode)];\r
+ }\r
+ \r
+ var wrapper = canvasNode.create({tag: wlxmlTag, klass: wlxmlClass});\r
+ this.canvas.nodeWrap({inside: canvasNode.create(parent),\r
+ _with: wrapper,\r
+ offsetStart: offsetStart,\r
+ offsetEnd: offsetEnd,\r
+ textNodeIdx: textNodeIdx\r
+ });\r
+ this.selectNode(wrapper, {movecaret: 'end'});\r
+ }\r
+ \r
+ \r
+}\r
+\r
+Manager.prototype.getNodeElement = function(cnode) {\r
+ return this.canvas.dom.find('#'+cnode.getId());\r