From 59be7cc79d8733d82f7ff4aa14d5afd40bf79eaa Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 12 Jan 2009 14:49:45 -0800 Subject: [PATCH] Fixed more focusing issues. --- static/js/Editor.js | 8 ++++++-- static/js/Wiki.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index edefb59..ec52b39 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -310,7 +310,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, "onclick", function ( event ) { self.focus( event ); self.mouse_clicked( event ); } ); + connect( this.div, "onclick", function ( 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 { @@ -318,7 +318,7 @@ Editor.prototype.connect_handlers = function () { connect( this.document, "onkeydown", function ( event ) { self.key_pressed( event ); } ); connect( this.document, "onkeyup", function ( event ) { self.key_released( event ); } ); } - connect( this.document, "onclick", function ( event ) { self.focus(); self.mouse_clicked( event ); } ); + connect( this.document, "onclick", function ( event ) { self.mouse_clicked( event ); } ); connect( this.document, "onmouseover", function ( event ) { self.mouse_hovered( event ); } ); connect( this.document, "ondragover", function ( event ) { self.mouse_dragged( event ); } ); connect( this.iframe.contentWindow, "onpaste", function ( event ) { setTimeout( function () { self.resize() }, 50 ); } ); @@ -641,6 +641,10 @@ Editor.prototype.mouse_clicked = function ( event ) { var link_clicked = handle_click( event ); + // if no link was clicked, then just focus the clicked editor + if ( !link_clicked ) + this.focus(); + // in case the cursor has moved, update the state if ( this.edit_enabled ) signal( this, "state_changed", this, link_clicked ); diff --git a/static/js/Wiki.js b/static/js/Wiki.js index d3c1d38..6283598 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -775,7 +775,7 @@ Wiki.prototype.parse_loaded_editor = function ( result, note_title, requested_re var read_write = this.notebook.read_write; var self = this; - var editor = this.create_editor( id, note_text, deleted_from_id, actual_revision, actual_creation, read_write, true, false, position_after, user_id, username ); + var editor = this.create_editor( id, note_text, deleted_from_id, actual_revision, actual_creation, read_write, true, true, position_after, user_id, username ); if ( !requested_revision ) connect( editor, "init_complete", function () { signal( self, "note_added", editor ); } ); id = editor.id;