Changeset 8069

Show
Ignore:
Timestamp:
04/12/07 05:47:50 (21 months ago)
Author:
liucougar
Message:

encoding text node correctly
set contentReadOnly to disable/enable the editor

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/widget/RichText.js

    r7981 r8069  
    735735                                this.editNode.contentEditable=true; 
    736736                        }else{ //moz 
    737                                 this.document.designMode='on'; 
     737                                this.document.execCommand('contentReadOnly', false, false); 
     738//                              this.document.designMode='on'; 
    738739                        } 
    739740                        this.enabled=true; 
     
    744745                                this.editNode.contentEditable=false; 
    745746                        }else{ //moz 
    746                                 this.blur(); //to remove the blinking caret 
    747                                 this.document.designMode='off'; 
     747                                this.document.execCommand('contentReadOnly', false, true); 
     748//                              this.blur(); //to remove the blinking caret 
     749//                              this.document.designMode='off'; 
    748750                        } 
    749751                        this.enabled=false; 
     
    764766 
    765767                                try { // sanity check for Mozilla 
    766                                         this.document.execCommand("useCSS", false, true); // old moz call 
     768//                                      this.document.execCommand("useCSS", false, true); // old moz call 
    767769                                        this.document.execCommand("styleWithCSS", false, false); // new moz call 
    768770                                        //this.document.execCommand("insertBrOnReturn", false, false); // new moz call 
     
    12361238                                dojo.withGlobal(this.window, "selectElement", dojo.html.selection, [a]); 
    12371239 
    1238                                 returnValue = this.document.execCommand("unlink", false, null); 
    1239  
    1240 //                              // restore original selection 
    1241 //                              var selectionRange = this.document.createRange(); 
    1242 //                              selectionRange.setStart(selectionStartContainer, selectionStartOffset); 
    1243 //                              selectionRange.setEnd(selectionEndContainer, selectionEndOffset); 
    1244 //                              selection.removeAllRanges(); 
    1245 //                              selection.addRange(selectionRange); 
    1246  
    1247                                 return returnValue; 
     1240                                return this.document.execCommand("unlink"); 
    12481241                        }else if((command == "hilitecolor")&&(dojo.render.html.mozilla)){ 
    1249                                 // mozilla doesn't support hilitecolor properly when useCSS is 
    1250                                 // set to false (bugzilla #279330) 
    1251  
    1252                                 this.document.execCommand("useCSS", false, false); 
     1242//                              // mozilla doesn't support hilitecolor properly when useCSS is 
     1243//                              // set to false (bugzilla #279330) 
     1244 
     1245//                              this.document.execCommand("useCSS", false, false); 
    12531246                                returnValue = this.document.execCommand(command, false, argument); 
    1254                                 this.document.execCommand("useCSS", false, true); 
     1247//                              this.document.execCommand("useCSS", false, true); 
    12551248 
    12561249                        }else if((dojo.render.html.ie)&&( (command == "backcolor")||(command == "forecolor") )){ 
     
    15851578                                        break; 
    15861579                                case 3: //text 
    1587                                         var output = node.nodeValue; 
     1580                                        var output = dojo.string.escapeXml(node.nodeValue,true); 
    15881581                                        break; 
    15891582                                case 8: //comment 
    1590                                         var output = '<!--'+node.nodeValue+'-->'; 
     1583                                        var output = '<!--'+dojo.string.escapeXml(node.nodeValue,true)+'-->'; 
    15911584                                        break; 
    15921585                                default: