loadWlxml: function(wlxml) {
var d = wlxml ? $($.trim(wlxml)) : null;
if(d) {
- var wrapper = $('<div>');
- wrapper.append(d);
+ this.wrapper = $('<div>').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;
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() {
$(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;