-Canvas.prototype._createNode = function(wlxmlTag, wlxmlClass) {\r
- var toBlock = ['div', 'document', 'section', 'header'];\r
- var htmlTag = _.contains(toBlock, wlxmlTag) ? 'div' : 'span';\r
- var toret = $('<' + htmlTag + '>');\r
- toret.attr('wlxml-tag', wlxmlTag);\r
- if(wlxmlClass)\r
- toret.attr('wlxml-class', wlxmlClass);\r
- toret.attr('id', 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);}));\r
- return toret;\r
- };\r
-\r
-Canvas.prototype.insertNode = function(options) {\r
- var element = $(this.content.find('#' + options.context.id).get(0));\r
- if(options.place == 'after')\r
- element[options.place](this._createNode(options.tag, options.klass));\r
- else if(options.place == 'wrapText') {\r
- var elementContents = element.contents();\r
- if(elementContents.length !== 1 || elementContents.get(0).nodeType != 3)\r
- return false;\r
- var textElement = elementContents.get(0);\r
-\r
- var prefix = textElement.data.substr(0, options.offsetStart);\r
- var suffix = textElement.data.substr(options.offsetEnd);\r
- var core = textElement.data.substr(options.offsetStart, options.offsetEnd - options.offsetStart);\r
- var newNode = this._createNode(options.tag, options.klass);\r
- newNode.text(core);\r
- $(textElement).replaceWith(newNode);\r
- newNode.before(prefix);\r
- newNode.after(suffix);\r
+Canvas.prototype.nodeAppend = function(options) {\r
+ var element; // = $(this.content.find('#' + options.context.id).get(0));\r
+ if(options.to === 'root') {\r
+ element = this.content;\r
+ } else {\r
+ element = $(this.content.find('#' + options.to.getId()).get(0));\r