fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactoring - moving key event handlers out of canvas object
[fnpeditor.git]
/
modules
/
documentCanvas
/
canvas
/
documentElement.js
diff --git
a/modules/documentCanvas/canvas/documentElement.js
b/modules/documentCanvas/canvas/documentElement.js
index
1a2ef91
..
0558a3e
100644
(file)
--- a/
modules/documentCanvas/canvas/documentElement.js
+++ b/
modules/documentCanvas/canvas/documentElement.js
@@
-74,7
+74,7
@@
$.extend(DocumentElement.prototype, {
},
wrapWithNodeElement: function(wlxmlNode) {
},
wrapWithNodeElement: function(wlxmlNode) {
- var wrapper = DocumentNodeElement.create({tag: wlxmlNode.tag, klass: wlxmlNode.klass});
+ var wrapper = DocumentNodeElement.create({tag: wlxmlNode.tag, klass: wlxmlNode.klass}
, this
);
this.dom().replaceWith(wrapper.dom());
wrapper.append(this);
return wrapper;
this.dom().replaceWith(wrapper.dom());
wrapper.append(this);
return wrapper;
@@
-109,6
+109,12
@@
$.extend(DocumentElement.prototype, {
return this.parents().some(function(parent) {
return parent.is('list');
});
return this.parents().some(function(parent) {
return parent.is('list');
});
+ },
+
+ exec: function(method) {
+ var manager = this.data('_wlxmlManager');
+ if(manager[method])
+ return manager[method].apply(manager, Array.prototype.slice.call(arguments, 1));
}
});
}
});
@@
-142,8
+148,10
@@
$.extend(DocumentNodeElement, {
}
element.data('other-attrs', params.others);
}
element.data('other-attrs', params.others);
- if(params.rawChildren) {
+ if(params.rawChildren
&& params.rawChildren.length
) {
container.append(params.rawChildren);
container.append(params.rawChildren);
+ } else if(params.prepopulateOnEmpty) {
+ element.append(DocumentTextElement.create({text: ''}));
}
return dom;
},
}
return dom;
},
@@
-522,8
+530,9
@@
$.extend(DocumentTextElement.prototype, {
prev.setText(prev.getText() + this.getText() + next.getText());
next.detach();
} else if (prev || next) {
prev.setText(prev.getText() + this.getText() + next.getText());
next.detach();
} else if (prev || next) {
- var target = prev ? prev : next;
- target.setText(target.getText() + this.getText());
+ var target = prev ? prev : next,
+ newText = prev ? target.getText() + this.getText() : this.getText() + target.getText();
+ target.setText(newText);
} else {
parent.after(this);
}
} else {
parent.after(this);
}