From b19f488d904d0514d893d34dde8acaf10735c86e Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 6 Oct 2008 15:35:38 -0700 Subject: [PATCH] Now also removing WebKit-generated tags that result from titling/untitling note text. --- static/js/Editor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index a09987f..2f09a3c 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -329,7 +329,8 @@ Editor.prototype.cleanup_html = function ( key_code ) { var style_spans = getElementsByTagAndClassName( "span", null, this.document ); var underlines = getElementsByTagAndClassName( "u", null, this.document ); var strikethroughs = getElementsByTagAndClassName( "strike", null, this.document ); - var nodes = style_spans.concat( underlines ).concat( strikethroughs ); + var fonts = getElementsByTagAndClassName( "font", "Apple-style-span", this.document ); + var nodes = style_spans.concat( underlines ).concat( strikethroughs ).concat( fonts ); for ( var i in nodes ) { var node = nodes[ i ]; @@ -338,9 +339,12 @@ Editor.prototype.cleanup_html = function ( key_code ) { var style = node.getAttribute( "style" ); node.removeAttribute( "class" ); - if ( style == undefined ) continue; + if ( style == undefined && node.tagName != "font" && node.tagName != "FONT" ) + continue; var replacement = withDocument( this.document, function () { + if ( style == undefined ) + return createDOM( "span" ); // font-size is set when ending title mode if ( style.indexOf( "font-size: " ) != -1 ) return null;