-Manager.prototype.getNodeElement = function(wlxmlNode) {\r
- return this.canvas.dom.find('#'+wlxmlNode.id);\r
+Manager.prototype.insertNewNode = function(wlxmlTag, wlxmlClass) {\r
+ var selection = window.getSelection();\r
+\r
+ if(selection.getRangeAt(0).collapsed) {\r
+ \r
+ } else {\r
+ var offsetStart = selection.anchorOffset;\r
+ var offsetEnd = selection.focusOffset;\r
+ if(offsetStart > offsetEnd) {\r
+ var tmp = offsetStart;\r
+ offsetStart = offsetEnd;\r
+ offsetEnd = tmp;\r
+ }\r
+ var wrapper = canvasNode.create({tag: wlxmlTag, klass: wlxmlClass});\r
+ this.canvas.nodeWrap({inside: canvasNode.create($(selection.anchorNode).parent()),\r
+ _with: wrapper,\r
+ offsetStart: offsetStart,\r
+ offsetEnd: offsetEnd\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