r1744 - branches/bxe_2_0/js
[email protected] Wed, 29 Aug 2007 14:23:22 +0200 (CEST)
| Newsgroups | gmane.editors.bitflux.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: chregu
Date: Wed Aug 29 14:23:22 2007
New Revision: 1744
Log:
fix an issue with "appendAllowedChildren", when there's not really a childnode
Modified:
branches/bxe_2_0/js/widget.js
Modified: branches/bxe_2_0/js/widget.js
==============================================================================
--- branches/bxe_2_0/js/widget.js (original)
+++ branches/bxe_2_0/js/widget.js Wed Aug 29 14:23:22 2007
@@ -977,10 +977,17 @@
if (_p == widget.AppendToNode._node) {
var cssr = sel.getEditableRange();
_p.betterNormalize();
- if (_p.childNodes.length) {
+ // second part is for checking, if we're in the correct node (if startContainer == parent, just append a textnode)
+ if (_p.childNodes.length && !(cssr.startContainer.nodeType == 1 && cssr.startContainer.XMLNode && cssr.startContainer.XMLNode._node == _p )) {
var _position = bxe_getChildPosition(cssr.startContainer);
- _p.childNodes[_position].splitText(cssr.startOffset);
- var _p2 = _p.childNodes[_position ]
+ //check if there's a node on that position, if not, just append a textnode
+ if (_p.childNodes[_position]) {
+ _p.childNodes[_position].splitText(cssr.startOffset);
+ var _p2 = _p.childNodes[_position ];
+ } else {
+ var _p2 = _p.appendChild(_p.ownerDocument.createTextNode(""));
+ _p2.init();
+ }
} else {
var _p2 = _p.appendChild(_p.ownerDocument.createTextNode(""));
_p2.init();
--
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs