Opened 15 years ago

Closed 14 years ago

#508 closed defect (wontfix)

IE inserts unnecessary font tags on paste within editor

Reported by: wreimer@… Owned by: gogo
Priority: normal Milestone: Version 1.0
Component: Xinha Core Version:
Severity: normal Keywords:


I've been working with HTMLArea for some time and have also contributed to Xinha anonymously. I have an issue that still shows up in Xinha but not as badly as in my version. In my case, IE inserts font tags which either unnecessarily reproduce or override classes or style attributes when copying and pasting within the editor. The worst offender is copying a simple link:

<a href="">link text</a>


<a href=""><font color="#0000ff">link text</font></a>

This doesn't seem to happen in Xinha, but I can't figure out what you did to fix it. Can anyone help me? AFAIK this is a recent IE bug, maybe with XP SP2.

Xinha still has this issue with other cut and paste operations. In the Xinha example, select some text and apply the .bluetext class, then copy that text along with some non-styled text, and this is what happens:

<span class="bluetext">Curabitur </span>tristique ante


<font color="#000000"><span class="bluetext">Curabitur </span>tristique ante</font>



Change History (4)

comment:1 Changed 15 years ago by wreimer@…

  • Summary changed from IE inserts unnecessary font tags on paste to IE inserts unnecessary font tags on paste within editor

comment:2 Changed 15 years ago by gogo

  • Milestone set to Version 1.0

Hmmm. My first inclination is that this is probably an IE bug and there may not be anything we can do about it (since we can't "catch" the paste text and clean it before inserting). Going to set this to Version 1.0 but I wouldn't hold out hope on it being fixable.

comment:3 Changed 15 years ago by anonymous

For solve this problem (IE 6)I have redefined the paste case in the htmarea.js:

case "paste":

var html = HTMLArea.getClipboardHTML();
var checkWordRE = /<\w[>]*(( class="?MsoNormal?"?)|(mso-))/gi ;
var checkFontRE = /<\/(font|b)>/gi ;

if (!checkWordRE.test(html) && !checkFontRE.test(html) )

try {

if (this.config.killWordOnPaste)


} catch (e) {

if (HTMLArea.is_gecko) {

alert(HTMLArea._lc("The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly."));




alert("Il testo incollato sembra provenire da Word/Adobe?. Premere Ok e incollare il testo nella finestra successiva.");

Method getClipboardHTML();
HTMLArea.getClipboardHTML = function()

var oDiv = document.getElementById( '_XinhaHiddenDiv' ) ;

if ( !oDiv )

var oDiv = document.createElement( 'DIV' ) ; = '_XinhaHiddenDiv' ; = 'hidden' ; = 'hidden' ; = 'absolute' ; = 1 ; = 1 ;

document.body.appendChild( oDiv ) ;


oDiv.innerHTML = ;

var oTextRange = document.body.createTextRange() ;
oTextRange.moveToElementText( oDiv ) ;
oTextRange.execCommand( 'paste' ) ;

var sData = oDiv.innerHTML ;
oDiv.innerHTML = ;

return sData ;


Method .insertHTML(html);
if (HTMLArea.is_ie)

HTMLArea.prototype.insertHTML = function(html)

var sel = this._getSelection();
var range = this._createRange(sel);


sel.clear(); NEW




comment:4 Changed 14 years ago by gogo

  • Resolution set to wontfix
  • Status changed from new to closed

Closing this as wontfix, nobody else has said anything about it so I'm inclined to believe it's something not worth worrying about (or maybe only a bug on submitters IE?)

Note: See TracTickets for help on using tickets.