}\r
\r
Canvas.prototype.setXML = function(xml) {\r
- this.xml = xml;\r
- this.content.html(transformations.fromXML.getHTMLTree(xml)); \r
+ this.xml = $.trim(xml);\r
+ this.content.html(transformations.fromXML.getHTMLTree(this.xml)); \r
}\r
\r
Canvas.prototype.toXML = function() {\r
node.remove();\r
list.append(node);\r
});\r
+}\r
+\r
+Canvas.prototype.removeList = function(options) {\r
+ var pointerElement = $(this.content.find('#' + options.pointer.id));\r
+ var listElement = options.pointer.klass === 'list-items' ? pointerElement : \r
+ pointerElement.parent('[wlxml-class="list-items"][wlxml-tag]');\r
\r
+ listElement.find('[wlxml-class=item]').each(function() {\r
+ $(this).attr('wlxml-class', '');\r
+ });;\r
+ listElement.children().unwrap();\r
\r
- \r
+}\r
+\r
+Canvas.prototype.insideList = function(options) {\r
+ if(options.pointer) {\r
+ if(options.pointer.klass === 'list-items' || options.pointer.klass === 'item')\r
+ return true;\r
+ var pointerElement = $(this.content.find('#' + options.pointer.id));\r
+ return pointerElement.parents('list-items').length > 0;\r
+ }\r
+ return false;\r
}\r
\r
\r