r1577 - branches/bxe_2_0/mozile

[email protected] Tue, 24 Oct 2006 23:19:34 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Tue Oct 24 23:19:33 2006
New Revision: 1577

Modified:
   branches/bxe_2_0/mozile/mozilekb.js
Log:
cleanup and try with normalize if insertion doesn't work

Modified: branches/bxe_2_0/mozile/mozilekb.js
==============================================================================
--- branches/bxe_2_0/mozile/mozilekb.js	(original)
+++ branches/bxe_2_0/mozile/mozilekb.js	Tue Oct 24 23:19:33 2006
@@ -607,8 +607,13 @@
 			if (!textNode) {
 				return false;
 			}
-			textNode.insertData(startOff , _ch);
-			
+			try {
+				textNode.insertData(startOff , _ch);
+			} catch (e) {
+				//try again with normalized
+				textNode.parentNode.betterNormalize();
+				textNode.insertData(startOff , _ch);
+			}
 			//textNode._childPosition = _position;
 		}
 		
@@ -655,7 +660,7 @@
 					if (_par) {
 						_par.removeChild(xmlnode);
 						_par.XMLNode.makeDefaultNodes();
-						bxe_Transform();
+						
 					} else {
 						bxe_deleteWholeSelection(sel,backspace);
 						sel = window.getSelection();
@@ -664,7 +669,7 @@
 				} else {
 					bxe_history_snapshot();
 					sel.deleteSelection(backspace);
-
+					
 				}
 			} else  {
 				var xmlnode = bxe_getXMLNodeByHTMLNode(sel.anchorNode);
@@ -685,10 +690,11 @@
 				}
 				
 			}
+			bxe_Transform();
 		} else {
 			bxe_history_snapshot();
 			sel.deleteSelection(backspace);
-
+			bxe_Transform();
 			
 		}
 		return true;
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs