From 25db885cb8b55a5243d9e5b9c80ea84ac3ca1d64 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 27 Jan 2009 16:13:23 -0800 Subject: [PATCH] Fix to prevent iframe editor from remaining focused when switching to a different static div editor with page up / page down. --- static/js/Wiki.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 64e00c2..7277fc0 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -1032,7 +1032,6 @@ Wiki.prototype.editor_focused = function ( editor, synchronous ) { this.focused_editor = editor; this.update_toolbar(); - } Wiki.prototype.make_byline = function ( username, creation, note_id ) { @@ -1195,14 +1194,17 @@ Wiki.prototype.editor_key_pressed = function ( editor, event ) { } Wiki.prototype.focus_next_editor = function () { - if ( !this.focused_editor ) { + if ( this.focused_editor ) { + var editor = this.focused_editor; + this.editor_focused( null ); + } else { var div = getFirstElementByTagAndClassName( "div", "static_note_div" ); if ( !div || !div.editor ) return; div.editor.highlight(); return; } - var previous_holder = this.focused_editor.holder.previousSibling; + var previous_holder = editor.holder.previousSibling; if ( !previous_holder ) return; if ( !hasElementClass( previous_holder, "note_holder" ) ) previous_holder = previous_holder.previousSibling; @@ -1213,14 +1215,17 @@ Wiki.prototype.focus_next_editor = function () { } Wiki.prototype.focus_previous_editor = function () { - if ( !this.focused_editor ) { + if ( this.focused_editor ) { + var editor = this.focused_editor; + this.editor_focused( null ); + } else { var div = getFirstElementByTagAndClassName( "div", "static_note_div" ); if ( !div || !div.editor ) return; div.editor.highlight(); return; } - var next_holder = this.focused_editor.holder.nextSibling; + var next_holder = editor.holder.nextSibling; if ( !next_holder ) return; if ( !hasElementClass( next_holder, "note_holder" ) ) next_holder = next_holder.nextSibling;