fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
integration wip: restoring document
[fnpeditor.git]
/
src
/
editor
/
modules
/
documentCanvas
/
canvas
/
documentElement.js
diff --git
a/src/editor/modules/documentCanvas/canvas/documentElement.js
b/src/editor/modules/documentCanvas/canvas/documentElement.js
index
374d5c7
..
89ffce9
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/documentElement.js
+++ b/
src/editor/modules/documentCanvas/canvas/documentElement.js
@@
-169,6
+169,9
@@
$.extend(DocumentNodeElement, {
var element = this.fromHTMLElement(dom[0], canvas);
var element = this.fromHTMLElement(dom[0], canvas);
+ element.data('wlxmlNode', wlxmlNode);
+ wlxmlNode.setData('canvasElement', element);
+
element.setWlxml({tag: wlxmlNode.getTagName(), klass: wlxmlNode.getClass()});
_.keys(wlxmlNode.getMetaAttributes()).forEach(function(key) {
element.setWlxml({tag: wlxmlNode.getTagName(), klass: wlxmlNode.getClass()});
_.keys(wlxmlNode.getMetaAttributes()).forEach(function(key) {
@@
-477,9
+480,12
@@
var DocumentTextElement = function(htmlElement, canvas) {
$.extend(DocumentTextElement, {
createDOM: function(wlxmlTextNode) {
$.extend(DocumentTextElement, {
createDOM: function(wlxmlTextNode) {
-
return
$('<div>')
+
var dom =
$('<div>')
.attr('document-text-element', '')
.attr('document-text-element', '')
- .text(wlxmlTextNode.getText() || utils.unicode.ZWS);
+ .text(wlxmlTextNode.getText() || utils.unicode.ZWS),
+ element = this.fromHTMLElement(dom[0], this);
+ element.data('wlxmlNode', wlxmlTextNode);
+ return dom;
},
create: function(wlxmlTextNode, canvas) {
},
create: function(wlxmlTextNode, canvas) {
@@
-521,8
+527,13
@@
$.extend(DocumentTextElement.prototype, {
prependText: function(text) {
this.dom().contents()[0].data = text + this.dom().contents()[0].data;
},
prependText: function(text) {
this.dom().contents()[0].data = text + this.dom().contents()[0].data;
},
- getText: function() {
- return this.dom().text().replace(utils.unicode.ZWS, '');
+ getText: function(options) {
+ options = _.extend({raw: false}, options || {});
+ var toret = this.dom().text();
+ if(!options.raw) {
+ toret = toret.replace(utils.unicode.ZWS, '');
+ }
+ return toret;
},
isEmpty: function() {
// Having at least Zero Width Space is guaranteed be Content Observer
},
isEmpty: function() {
// Having at least Zero Width Space is guaranteed be Content Observer