r1595 - branches/bxe_2_0/mozile
[email protected] Tue, 31 Oct 2006 17:08:08 +0100 (CET)
| Newsgroups | gmane.editors.bitflux.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: chregu
Date: Tue Oct 31 17:08:07 2006
New Revision: 1595
Modified:
branches/bxe_2_0/mozile/mozilekb.js
Log:
only insert elements on return if bxe:nextelement is defined
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 31 17:08:07 2006
@@ -375,73 +375,72 @@
if (cssr.startContainer.parentNode.XMLNode.vdom.bxeNoteditable) {
return false;
}
-
- if(!cssr.collapsed)
- { // POST04: delete text when write over it!
- bxe_deleteWholeSelection(sel,false);
- }
- sel.removeAllRanges();
- ip = documentCreateInsertionPoint(cssr.top, cssr.startContainer, cssr.startOffset);
-
- // POST04: support concept of not splitting line if mozUserModify indicates writeText ...
- if (cssr.top._SourceMode) {
- ip.insertCharacter(10);
- }
- else {
- td = false;
- var _con = ip.line.container;
- if (_con == ip.line.tableCellAncestor) {
- td = true
- }
- var _par = ip.ipNode.parentNode;
- //FIXME make soft breaks configurable
- if ( event.shiftKey) {
- if (_par.XMLNode.isAllowedChild(XHTMLNS,"br")) {
- var secondTextNode = ip.ipNode.splitText(ip.ipOffset);
- ip.ipNode.parentNode.insertBefore(documentCreateXHTMLElement("br"), secondTextNode);
- ip.forwardOne();
- _par.updateXMLNode();
- }
+ var lala = cssr.startContainer.parentNode.XMLNode;
+ if (lala.vdom.bxeNextelement) {
+ if(!cssr.collapsed)
+ { // POST04: delete text when write over it!
+ bxe_deleteWholeSelection(sel,false);
+ }
+ sel.removeAllRanges();
+ ip = documentCreateInsertionPoint(cssr.top, cssr.startContainer, cssr.startOffset);
+
+ // POST04: support concept of not splitting line if mozUserModify indicates writeText ...
+ if (cssr.top._SourceMode) {
+ ip.insertCharacter(10);
}
else {
- var lala = cssr.startContainer.parentNode.XMLNode;
-
- var z = 0;
- var textNode = cssr.startContainer;
- while (textNode) {
- textNode = textNode.previousSibling;
- z++;
+ td = false;
+ var _con = ip.line.container;
+ if (_con == ip.line.tableCellAncestor) {
+ td = true
+ }
+ var _par = ip.ipNode.parentNode;
+ //FIXME make soft breaks configurable
+ if ( event.shiftKey) {
+ if (_par.XMLNode.isAllowedChild(XHTMLNS,"br")) {
+ var secondTextNode = ip.ipNode.splitText(ip.ipOffset);
+ ip.ipNode.parentNode.insertBefore(documentCreateXHTMLElement("br"), secondTextNode);
+ ip.forwardOne();
+ _par.updateXMLNode();
+ }
}
- textNode = lala._node.childNodes[z-1];
-
- //var ip2 = documentCreateInsertionPoint(lala._node, textNode, cssr.startOffset);
- //ip2.splitXHTMLLine();
- //we're at the end of the line
- if (textNode.data.replace(/[\s\n\t\r]*$/,"").length <= cssr.startOffset) {
- if (lala.vdom.bxeNextelement) {
+ else {
+ //only split if bxeNextelement is set
+ var z = 0;
+ var textNode = cssr.startContainer;
+ while (textNode) {
+ textNode = textNode.previousSibling;
+ z++;
+ }
+ textNode = lala._node.childNodes[z-1];
+
+ //we're at the end of the line
+ if (textNode.data.replace(/[\s\n\t\r]*$/,"").length <= cssr.startOffset) {
+ if (lala.vdom.bxeNextelement) {
eDOMEventCall("appendNode",document,{"appendToNode": lala, "localName":lala.vdom.bxeNextelement, "namespaceURI":null});// ,"namespaceURI":widget.InsertNamespaceURI})
- } else {
+ }
+ // useless for now, bt maybe needed again later
+ // FIXME: check, if allowed :)
+ else {
eDOMEventCall("appendNode",document,{"appendToNode": lala, "localName":lala.localName, "namespaceURI":lala.namespaceURI});// ,"namespaceURI":widget.InsertNamespaceURI})
+ }
+ }
+ else {
+ //FIXME: check if allowed
+ textNode.splitText(cssr.startOffset);
+ lala._node.split(z);
+ lala._node.nextSibling.removeAttribute("__bxe_id");
+ var _id = lala._node.nextSibling.setBxeId();
+ /** doesn't work the if here... **/
+
+ bxe_Transform(_id,0,lala.parentNode);
}
- }
- else {
- textNode.splitText(cssr.startOffset);
- lala._node.split(z);
- lala._node.nextSibling.removeAttribute("__bxe_id");
- var _id = lala._node.nextSibling.setBxeId();
- /** doesn't work the if here... **/
- bxe_Transform(_id,0,lala.parentNode);
}
+ bxe_history_snapshot_async();
}
- bxe_history_snapshot_async();
+ bxe_delayedUpdateXPath();
}
- /*cssr.selectInsertionPoint(ip);
- sel.removeAllRanges();
- sel.addRange(cssr);*/
-
-
- bxe_delayedUpdateXPath();
return true;
}
--
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs