From 81e3ca7ab2734f7409f10429fe1e3fe74b9b22d8 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 12 Jul 2009 13:55:48 -0700 Subject: [PATCH] Simplified cleanup_range() function. --- static/js/Editor.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index b55b39e..232f2ad 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -1031,17 +1031,10 @@ Editor.prototype.cleanup_html = function ( key_code ) { } Editor.prototype.cleanup_range = function () { - if ( !this.iframe.contentWindow.getSelection ) - return; - - var selection = this.iframe.contentWindow.getSelection(); - if ( selection.rangeCount > 0 ) - var range = selection.getRangeAt( 0 ); - else - var range = this.document.createRange(); - - if ( range.collapsed ) - this.exec_command( "removeformat" ); + if ( this.iframe.contentWindow.getSelection ) + var selection = this.iframe.contentWindow.getSelection(); + if ( selection.isCollapsed ) + this.exec_command( "removeformat" ); } Editor.prototype.unformat_selection = function () {