fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allowing for canvas to listen to dom key events
[fnpeditor.git]
/
modules
/
documentCanvas
/
canvas
/
canvas.js
diff --git
a/modules/documentCanvas/canvas/canvas.js
b/modules/documentCanvas/canvas/canvas.js
index
90dac8c
..
45c7fe2
100644
(file)
--- 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) {
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;
var currentTag = $(this);
if(currentTag.attr('wlxml-tag'))
return;
@@
-31,7
+31,7
@@
$.extend(Canvas.prototype, {
return element;
});
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() {
.filter(function() {return this.nodeType === Node.TEXT_NODE})
.each(function() {
@@
-65,13
+65,16
@@
$.extend(Canvas.prototype, {
$(this).replaceWith(element.dom());
});
$(this).replaceWith(element.dom());
});
- this.d = wrapper.children(0);
- this.d.unwrap();
+ this.d = this.wrapper.children(0);
} else {
this.d = null;
}
},
} else {
this.d = null;
}
},
+ view: function() {
+ return this.wrapper;
+ },
+
doc: function() {
if(this.d === null)
return null;
doc: function() {
if(this.d === null)
return null;