X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/bedc5daf8a42c50c84b8c43b5924c10d07ed0b3a..064901239c2478c0fa4763812771cb370c76742d:/modules/documentCanvas/canvas/canvas.js?ds=sidebyside diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 90dac8c..45c7fe2 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -15,10 +15,10 @@ $.extend(Canvas.prototype, { loadWlxml: function(wlxml) { var d = wlxml ? $($.trim(wlxml)) : null; if(d) { - var wrapper = $('
'); - wrapper.append(d); + this.wrapper = $('
').addClass('canvas-wrapper').attr('contenteditable', true); + this.wrapper.append(d); - wrapper.find('*').replaceWith(function() { + this.wrapper.find('*').replaceWith(function() { var currentTag = $(this); if(currentTag.attr('wlxml-tag')) return; @@ -31,7 +31,7 @@ $.extend(Canvas.prototype, { return element; }); - wrapper.find(':not(iframe)').addBack().contents() + this.wrapper.find(':not(iframe)').addBack().contents() .filter(function() {return this.nodeType === Node.TEXT_NODE}) .each(function() { @@ -65,13 +65,16 @@ $.extend(Canvas.prototype, { $(this).replaceWith(element.dom()); }); - this.d = wrapper.children(0); - this.d.unwrap(); + this.d = this.wrapper.children(0); } else { this.d = null; } }, + view: function() { + return this.wrapper; + }, + doc: function() { if(this.d === null) return null;