Ticket #656: insertHTML.patch

File insertHTML.patch, 1.2 KB (added by mokhet, 14 years ago)
  • htmlarea.js

     
    32143214/** Call this function to insert HTML code at the current position.  It deletes 
    32153215 * the selection, if any. 
    32163216 */ 
    3217 HTMLArea.prototype.insertHTML = function(html) { 
    3218   var sel = this._getSelection(); 
    3219   var range = this._createRange(sel); 
    3220   this.focusEditor(); 
    3221   if (HTMLArea.is_ie) { 
     3217if (HTMLArea.is_ie) { 
     3218  HTMLArea.prototype.insertHTML = function(html) { 
     3219    var sel = this._getSelection(); 
     3220    var range = this._createRange(sel); 
     3221    this.focusEditor(); 
    32223222    range.pasteHTML(html); 
    3223   } else { 
     3223  }; 
     3224} else { 
     3225  HTMLArea.prototype.insertHTML = function(html) { 
     3226    var sel = this._getSelection(); 
     3227    var range = this._createRange(sel); 
     3228    this.focusEditor(); 
    32243229    // construct a new document fragment with the given HTML 
    32253230    var fragment = this._doc.createDocumentFragment(); 
    32263231    var div = this._doc.createElement("div"); 
     
    32313236    } 
    32323237    // this also removes the selection 
    32333238    var node = this.insertNodeAtSelection(fragment); 
    3234   } 
    3235 }; 
     3239  }; 
     3240} 
    32363241 
    32373242/** 
    32383243 *  Call this function to surround the existing HTML code in the selection with