r1738 - branches/bxe_2_0/js
[email protected] Sat, 18 Aug 2007 12:32:46 +0200 (CEST)
| Newsgroups | gmane.editors.bitflux.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: chregu
Date: Sat Aug 18 12:32:46 2007
New Revision: 1738
Log:
- fix an issue, if you wanted to insert an element into an element with no children
- do not add tags, if there's only one optional child in rng
Modified:
branches/bxe_2_0/js/bxeXMLNode.js
branches/bxe_2_0/js/widget.js
Modified: branches/bxe_2_0/js/bxeXMLNode.js
==============================================================================
--- branches/bxe_2_0/js/bxeXMLNode.js (original)
+++ branches/bxe_2_0/js/bxeXMLNode.js Sat Aug 18 12:32:46 2007
@@ -344,7 +344,6 @@
var ret = false;
var cHT = this.canHaveText;
if (!noPlaceholderText) {
-
if (cHT ) {
if (this.vdom && this.vdom.bxeDefaultcontent) {
@@ -368,7 +367,9 @@
} else {
var ac = this.allowedChildren;
if (ac.length == 1) {
- eDOMEventCall("appendChildNode",document,{"noTransform": true, "appendToNode": this, "localName":ac[0].localName,"namespaceURI":ac[0].namespaceURI});
+ if (!ac[0].optional) {
+ eDOMEventCall("appendChildNode",document,{"noTransform": true, "appendToNode": this, "localName":ac[0].localName,"namespaceURI":ac[0].namespaceURI});
+ }
ret = this;
} else if (ac.length > 1) {
var _hasMust = false;
Modified: branches/bxe_2_0/js/widget.js
==============================================================================
--- branches/bxe_2_0/js/widget.js (original)
+++ branches/bxe_2_0/js/widget.js Sat Aug 18 12:32:46 2007
@@ -977,9 +977,14 @@
if (_p == widget.AppendToNode._node) {
var cssr = sel.getEditableRange();
_p.betterNormalize();
- var _position = bxe_getChildPosition(cssr.startContainer);
- _p.childNodes[_position].splitText(cssr.startOffset);
- var _p2 = _p.childNodes[_position ]
+ if (_p.childNodes.length) {
+ var _position = bxe_getChildPosition(cssr.startContainer);
+ _p.childNodes[_position].splitText(cssr.startOffset);
+ var _p2 = _p.childNodes[_position ]
+ } else {
+ var _p2 = _p.appendChild(_p.ownerDocument.createTextNode(""));
+ _p2.init();
+ }
} else {
while (_p && _p != widget.AppendToNode._node) {
if (_p.XMLNode) {
@@ -989,7 +994,6 @@
}
}
if (_p2) {
-
eDOMEventCall("appendNode",document,{"appendToNode": _p2.XMLNode, "localName":widget.InsertLocalName,"namespaceURI":widget.InsertNamespaceURI})
}
--
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs