Changeset 5006 for branches


Ignore:
Timestamp:
08/30/11 10:50:07 (13 years ago)
Author:
rafaelraymundo
Message:

Ticket #2221 - Falha ao inserir mais de uma imagem no corpo da mensagem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/expressoMail1_2/js/rich_text_editor.js

    r4450 r5006  
    66        this.buildEditor(); 
    77        this.saveFlag = 0; 
     8        this.selRng = null; 
     9        this.selBmk = null; 
    810} 
    911 
     
    6668                        } 
    6769                }); 
     70 
     71                if (is_ie) { 
     72                        iframe.attachEvent("onbeforedeactivate", function() { 
     73                                RichTextEditor.saveSelection(); 
     74                        }); 
     75                } 
    6876 
    6977                parentDiv.appendChild(iframe); 
     
    392400                                mainField.document.execCommand('inserthtml', false, option); 
    393401                        } 
    394                 else if (command == 'Image') 
     402                else if (command == 'Image'){ 
     403                        if (is_ie) { 
     404                                this.restoreSelection(); 
     405                        } 
    395406                        mainField.document.execCommand('InsertImage', false, option); 
    396                 else if (command == 'spellCheck' && preferences.use_SpellChecker != '0'){ 
    397                         beginSpellCheck(); // configure 
    398                         spellCheck(); // run spellChecker 
    399                 } 
     407                        RichTextEditor.selRng = null; 
     408                        RichTextEditor.selBmk = null; 
     409                } 
     410        else if (command == 'spellCheck' && preferences.use_SpellChecker != '0'){ 
     411            beginSpellCheck(); // configure 
     412            spellCheck(); // run spellChecker 
     413        } 
    400414                else 
    401415                        mainField.document.execCommand(command, false, option); 
     
    669683} 
    670684 
     685cRichTextEditor.prototype.saveSelection = function() { 
     686        //save last selection for IE 
     687        try { 
     688                RichTextEditor.selRng = Element(this.editor).contentWindow.document.selection.createRange(); 
     689                RichTextEditor.selBmk = RichTextEditor.selRng.getBookmark(); 
     690        } 
     691        catch (e) { 
     692                RichTextEditor.selRng = null; 
     693                RichTextEditor.selBmk = null; 
     694        } 
     695} 
     696 
     697cRichTextEditor.prototype.restoreSelection = function() { 
     698        //restablish last selection for IE 
     699        if (RichTextEditor.selRng!=null) 
     700        { 
     701                try { 
     702                        RichTextEditor.selRng.moveToBookmark(RichTextEditor.selBmk); 
     703                        RichTextEditor.selRng.select(); 
     704                } 
     705                catch (e) { } 
     706        } 
     707} 
     708 
    671709//Build the Object 
    672710RichTextEditor = new cRichTextEditor(); 
Note: See TracChangeset for help on using the changeset viewer.