Changeset 8876


Ignore:
Timestamp:
03/05/07 22:30:37 (5 years ago)
Author:
sys
Message:

Améliorations gestion espace inséccable : court-circuite Moz qui les remplace par des espaces normaux dans un flot de saisie.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_textPrim/xedUi/text.xbl.xml

    r8873 r8876  
    34453445                                                if(vCar==32){ 
    34463446                                                        //On check qu'il n'y ait pas déjà un espace autour. 
    3447                                                         vRange = vSel.getRangeAt(0); 
    34483447                                                        var vNode = vRange.startContainer; 
    34493448                                                        if(vNode.nodeType==3) { 
     
    34613460                                                } 
    34623461                                                this.fRichTextInput.setDirty(true); 
    3463                                                 if(xed.getCurrentLang().indexOf("fr")>=0 && (vCar==58 || vCar==59 || vCar==33 || vCar==63) ) { 
    3464                                                         vRange = vSel.getRangeAt(0); 
    3465                                                         var vNode = vRange.startContainer; 
    3466                                                         if(vNode.nodeType==3) { 
    3467                                                                 var vStart = vRange.startOffset; 
    3468                                                                 if(vStart > 0){ 
    3469                                                                         var vPrevCharCode = vNode.data.charCodeAt(vStart - 1); 
    3470                                                                         //Espace inséccable déjà là ou protocole, comportement normal 
    3471                                                                         if(vPrevCharCode == 160 || ( vCar==58 && /\bmailto$|\b(ht|s?f)tp(s?)$/.test(vNode.data)) ) return;  
     3462                                                var vNode = vRange.startContainer; 
     3463                                                if(vNode.nodeType==3) { 
     3464                                                        var vStart = vRange.startOffset; 
     3465                                                        if(vStart > 0){ 
     3466                                                                var vPrevCharCode = vNode.data.charCodeAt(vStart - 1); 
     3467                                                                //si char précédent = espace inséccable, on gère nous-même sinon Moz remplace par un espace normal. 
     3468                                                                //ponctuation française sauf ':' suivant un protocole, comportement normal 
     3469                                                                if(vPrevCharCode==160 || (xed.getCurrentLang().indexOf("fr")>=0 && (vCar==59 || vCar==33 || vCar==63 || (vCar==58 && ! /\bmailto$|\b(ht|s?f)tp(s?)$/.test(vNode.data)) )) ) { 
    34723470                                                                        var vTrans = { 
    34733471                                                                                doTransaction : function(){ 
    3474                                                                                         if(vPrevCharCode == 32) { 
     3472                                                                                        if(vPrevCharCode == 32 || vPrevCharCode == 160) { 
    34753473                                                                                                vNode.replaceData(vStart-1, 1, String.fromCharCode(0xA0, vCar)); 
    34763474                                                                                                vSel.collapse(vNode, vStart+1); 
  • trunk/Xul_XedLib/chrome/content/scenarixedlib/core/xed.js

    r8873 r8876  
    19951995                                                                if( ! vSel.isCollapsed) vEditor.deleteSelection(0); 
    19961996                                                                var vPrevCharCode = vNode.data.charCodeAt(vStart - 1); 
    1997                                                                 //Espace inséccable déjà là ou protocole précédant uun ":", comportement normal 
    1998                                                                 if(vPrevCharCode == 160 || ( vCar==58 && /\bmailto$|\b(ht|s?f)tp(s?)$/.test(vNode.data)) ) return; 
     1997                                                                //':' suivant un protocole, comportement normal 
     1998                                                                if( vCar==58 && /\bmailto$|\b(ht|s?f)tp(s?)$/.test(vNode.data) ) return; 
    19991999                                                                var vTrans = { 
    20002000                                                                        doTransaction : function(){ 
    2001                                                                                 if(vPrevCharCode == 32) { 
     2001                                                                                if(vPrevCharCode == 32 || vPrevCharCode == 160) { 
    20022002                                                                                        vNode.replaceData(vStart-1, 1, String.fromCharCode(0xA0, vCar)); //0xA0 
    20032003                                                                                        vSel.collapse(vNode, vStart+1); 
Note: See TracChangeset for help on using the changeset viewer.