Changeset 12925
- Timestamp:
- 03/01/09 19:56:52 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Xul_XedLib/chrome/content/scenarixedlib/libUiExtra/scRichText/textBase.xbl.xml
r12924 r12925 165 165 if(pInTransaction) { 166 166 this.insertElt(vPara, vNode, null); 167 //this.fHTMLEditor.insertNode(vPara, vNode, 0);168 167 } else { 169 168 vNode.appendChild(this.createPara()); … … 178 177 if(pInTransaction) { 179 178 this.insertElt(vCaption, vNode, vNode.firstChild); 180 //this.fHTMLEditor.insertNode(vCaption, vNode, 0);181 179 } else { 182 180 vNode.insertBefore(vCaption, vNode.firstChild); … … 190 188 if(pInTransaction) { 191 189 this.insertElt(vCol, vNode, vCaption ? vCaption.nextSibling : vNode.firstChild); 192 //this.fHTMLEditor.insertNode(vCol, vNode, vCaption ? 1 : 0);193 190 } else { 194 191 vNode.insertBefore(vCol, vCaption ? vCaption.nextSibling : vNode.firstChild); … … 202 199 if(pInTransaction) { 203 200 this.insertElt(vTR, vNode, null); 204 //this.fHTMLEditor.insertNode(vTR, vNode, vNode.childNodes.length);205 201 } else { 206 202 vNode.appendChild(vTR); … … 220 216 if(pInTransaction) { 221 217 this.insertElt(vNewTD, vNode, null); 222 //this.fHTMLEditor.insertNode(vNewTD, vNode, vNode.childNodes.length);223 218 } else { 224 219 vNode.appendChild(vNewTD); … … 244 239 if( ! vNode.hasChildNodes() || vNode.lastChild.nodeName!="BR") { 245 240 if(pInTransaction) { 246 this. fHTMLEditor.insertNode(vDoc.createElement("BR"), vNode, vNode.childNodes.length);241 this.insertElt(vDoc.createElement("BR"), vNode, null); 247 242 } else { 248 243 vNode.appendChild(vDoc.createElement("BR")); … … 2453 2448 if(pRole) vTR.setAttribute("role", pRole); 2454 2449 this.insertElt(vTR, pTable, pBefore); 2455 //this.fHTMLEditor.insertNode(vTR, pTable, pBefore ? this.getOffsetInParent(pBefore) : pTable.childNodes.length);2456 2450 this.checkForEdit(vTR, true); 2457 2451 } … … 3750 3744 if(vCh.nodeName != "BR") { 3751 3745 this.deleteElt(vCh); 3752 this. fHTMLEditor.insertNode(vCh, vReceiver, vReceiver.childNodes.length - 1);3746 this.insertElt(vCh, vReceiver, vReceiver.lastChild); 3753 3747 } 3754 3748 vCh = vNext; … … 4047 4041 ]]></body> 4048 4042 </method> 4043 <!-- Transaction pour l'insertion d'un tableau de noeuds. --> 4044 <method name="insertElts"> 4045 <parameter name="pNodes"/> 4046 <parameter name="pParent"/> 4047 <parameter name="pBefore"/> 4048 <body><![CDATA[ 4049 var vTrans = { fNodes : pNodes, 4050 fParent : pParent, 4051 fNext : pBefore, 4052 merge : function(pTrans){return false;}, 4053 isTransient : false 4054 }; 4055 4056 vTrans.doTransaction = function(){ 4057 for(var i = 0; i < this.fNodes.length; i++) { 4058 this.fParent.insertBefore(this.fNodes[i], this.fNext); 4059 } 4060 } 4061 vTrans.undoTransaction = function(){ 4062 for(var i = this.fNodes.length - 1; i >=0 ; i--) { 4063 this.fParent.removeChild(this.fNodes[i]); 4064 } 4065 } 4066 vTrans.redoTransaction = function(){ 4067 this.doTransaction(); 4068 } 4069 this.fHTMLEditor.doTransaction(vTrans); 4070 ]]></body> 4071 </method> 4049 4072 <!-- Transaction pour replacer la sélection sur un undo --> 4050 4073 <method name="addTransSelForUndo"> … … 4183 4206 //On insert le texte 4184 4207 if(pParent.nodeType == 1) { 4185 //On est pas dans un text, on cherche un frère de type text4208 //On n'est pas dans un text, on cherche un frère de type text 4186 4209 var vNode = pParent.childNodes[pOffset]; 4187 4210 if(vNode && vNode.nodeType == 3) { … … 4195 4218 } else { 4196 4219 //Pas de noeud text autour, on crée un nouveau noeud. 4197 this. fHTMLEditor.insertNode(this.fHTMLEditor.document.createTextNode(pCdata), pParent, pOffset);4220 this.insertElt(this.fHTMLEditor.document.createTextNode(pCdata), pParent, pParent.childNodes[pOffset]); 4198 4221 return; 4199 4222 } … … 4699 4722 //On transforme tous les parablocks/textblock pour les insérer en member de la liste 4700 4723 var vThis = this; 4701 var v Inserted = 0;4724 var vNodeToInsert = []; 4702 4725 function insertBlock(pXmlParent) { 4703 var vCh = pXmlParent. lastChild;4726 var vCh = pXmlParent.firstChild; 4704 4727 while(vCh) { 4705 4728 var vClass = vThis.fClasses._xml[vCh.localName]; … … 4712 4735 vThis.xml2html(vCh, vNewPara, pEraseId, vElParent); 4713 4736 vThis.checkForEdit(vNewPara, false); 4714 vThis.fHTMLEditor.insertNode(vNewPara, vElParent, pOffset); 4715 vInserted++; 4737 vNodeToInsert.push(vNewPara); 4716 4738 //xed.debug("result::\n"+xed.getXml(vNewPara)); 4717 4739 } else if(vClass.type==6) { … … 4720 4742 } 4721 4743 } 4722 vCh = vCh. previousSibling;4744 vCh = vCh.nextSibling; 4723 4745 } 4724 4746 } 4725 4747 insertBlock(pNodeRoot); 4726 if(vInserted>0) { 4748 if(vNodeToInsert.length>0) { 4749 this.insertElts(vNodeToInsert, vElParent, vElParent.childNodes.item(pOffset)); 4727 4750 var vRange = this.fHTMLEditor.document.createRange(); 4728 4751 vRange.setStart(pParent, pOffset); 4729 vRange.setEnd(pParent, pOffset +vInserted);4752 vRange.setEnd(pParent, pOffset + vNodeToInsert.length); 4730 4753 return vRange; 4731 4754 } else return null; … … 4750 4773 var vRange = this.fHTMLEditor.document.createRange(); 4751 4774 vRange.setStart(vElParent, pOffset); 4752 var vInserted = 0; 4753 while(vFrag.hasChildNodes()) { 4754 this.fHTMLEditor.insertNode(vFrag.lastChild, vElParent, pOffset); 4755 vInserted++; 4756 } 4757 vRange.setEnd(vElParent, pOffset+vInserted); 4775 var vNodeToInsert = []; 4776 while(vFrag.hasChildNodes()) vNodeToInsert.push(vFrag.removeChild(vFrag.firstChild)); 4777 this.insertElts(vNodeToInsert, vElParent, vElParent.childNodes.item(pOffset)); 4778 vRange.setEnd(vElParent, pOffset + vNodeToInsert.length); 4758 4779 return vRange; 4759 4780 }
Note: See TracChangeset
for help on using the changeset viewer.