Changeset 963 for trunk/modules/Gecko


Ignore:
Timestamp:
02/04/08 17:23:41 (12 years ago)
Author:
ray
Message:

#1150 synchronize "Remove Format" between browsers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/Gecko/Gecko.js

    r962 r963  
    366366      return true; // Indicate paste is done, stop command being issued to browser by Xinha.prototype.execCommand 
    367367    } 
     368    break; 
     369    case 'removeformat': 
     370      var editor = this.editor; 
     371      var sel = editor.getSelection(); 
     372      var selSave = editor.saveSelection(sel); 
     373      var range = editor.createRange(sel); 
     374 
     375      var els = editor._doc.body.getElementsByTagName('*'); 
     376 
     377      var start = ( range.startContainer.nodeType == 1 ) ? range.startContainer : range.startContainer.parentNode; 
     378      var i, el; 
     379      if (sel.isCollapsed) range.selectNodeContents(editor._doc.body); 
     380       
     381      for (i=0; i<els.length;i++) 
     382      { 
     383        el = els[i]; 
     384        if ( range.isPointInRange(el, 0) || (els[i] == start && range.startOffset == 0)) 
     385        { 
     386          el.removeAttribute('style'); 
     387        } 
     388      } 
     389      this.editor._doc.execCommand(cmdID, UI, param); 
     390      editor.restoreSelection(selSave); 
     391      return true; 
     392    break; 
    368393  } 
    369394   
Note: See TracChangeset for help on using the changeset viewer.