+Canvas.prototype.nodeWrap2 = function(options) {\r
+ var container = $(this.content.find('#' + options.inside.getId()).get(0));\r
+ \r
+ var containerContent = container.contents();\r
+ var idx1 = Math.min.apply(Math, options.textNodeIdx);\r
+ var idx2 = Math.max.apply(Math, options.textNodeIdx);\r
+ var textNode1 = $(containerContent.get(idx1));\r
+ var textNode2 = $(containerContent.get(idx2));\r
+ \r
+ textNode1.after(options._with.dom);\r
+ textNode1.detach();\r
+ textNode2.detach();\r
+ \r
+ \r
+ options._with.dom.before(textNode1.text().substr(0, options.offsetStart));\r
+ options._with.dom.append(textNode1.text().substr(options.offsetStart));\r
+ for(var i = idx1 + 1; i < idx2; i++) {\r
+ options._with.dom.append(containerContent[i]);\r
+ }\r
+ options._with.dom.append(textNode2.text().substr(0, options.offsetEnd));\r
+ options._with.dom.after(textNode2.text().substr(options.offsetEnd));\r
+};\r
+\r