From b25cc973088dfaf3bf46d6f5f7b507228c22e6de Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Fri, 9 Jan 2009 17:15:07 -0800 Subject: [PATCH] Fix for broken focusing. --- static/js/Editor.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index 8bf84b6..156e098 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -299,7 +299,7 @@ Editor.prototype.create_div = function ( position_after ) { } Editor.prototype.connect_handlers = function () { - if ( this.edit_enabled ) { + if ( this.document && this.document.body ) { // since the browser may subtly tweak the html when it's inserted, save off the browser's version // of the html here. this yields more accurate comparisons within the dirty() method if ( this.start_dirty ) @@ -311,8 +311,7 @@ Editor.prototype.connect_handlers = function () { var self = this; // necessary so that the member functions of this editor object are used if ( this.div ) { - connect( this.div, "onfocus", function ( event ) { self.focused( event ); } ); - connect( this.div, "onclick", function ( event ) { self.mouse_clicked( event ); } ); + connect( this.div, "onclick", function ( event ) { self.focused( event ); self.mouse_clicked( event ); } ); connect( this.div, "onmouseover", function ( event ) { self.mouse_hovered( event ); } ); connect( this.div, "ondragover", function ( event ) { self.mouse_dragged( event ); } ); } else { @@ -867,10 +866,8 @@ Editor.prototype.find_link_at_cursor = function () { } Editor.prototype.focus = function () { - if ( this.div ) { - this.div.focus(); + if ( this.div ) return; - } if ( OPERA ) this.iframe.focus();