X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/edd85d12e3446e6d30ecb3b67519d53933a3b621..30ab52867dd38bdf8bda76e60be833b2603fb6ab:/modules/documentCanvas/canvas.js?ds=inline diff --git a/modules/documentCanvas/canvas.js b/modules/documentCanvas/canvas.js index dc64cac..92c02c6 100644 --- a/modules/documentCanvas/canvas.js +++ b/modules/documentCanvas/canvas.js @@ -9,13 +9,14 @@ define([ 'use strict'; var Canvas = function(xml) { - this.xml = xml; this.dom = $(template); - - this.content = this.dom.find('#rng-module-documentCanvas-content') - - - this.content.html(transformations.fromXML.getHTMLTree(xml)); + this.content = this.dom.find('#rng-module-documentCanvas-content'); + this.setXML(xml); +} + +Canvas.prototype.setXML = function(xml) { + this.xml = xml; + this.content.html(transformations.fromXML.getHTMLTree(xml)); } Canvas.prototype.toXML = function() { @@ -102,6 +103,13 @@ Canvas.prototype.splitNode = function(options) { newNode.append(node) }); nodeToSplit.after(newNode); + return newNode; +} + +Canvas.prototype.removeNode = function(options) { + var toRemove = $(this.content.find('#' + options.node.id).get(0)); + toRemove.remove(); + } Canvas.prototype.createList = function(options) {