From aa30c4785e6365acf97c481bd796d5bdbd056332 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Thu, 21 Nov 2002 23:53:50 +0000 Subject: [PATCH] Fixed command disabling/focus setting when loading page into new editor. b=181002, r=brade, sr=kin --- editor/ui/composer/content/editor.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/editor/ui/composer/content/editor.js b/editor/ui/composer/content/editor.js index 3d0f19aed7b..590d33eae40 100644 --- a/editor/ui/composer/content/editor.js +++ b/editor/ui/composer/content/editor.js @@ -283,8 +283,10 @@ var gEditorDocumentObserver = if (editorType != "htmlmail" && editorType != "textmail") { - // Mail Composers start focus in address area - gContentWindow.focus(); + // Set focus to content window if not a mail composer + // Race conditions prevent us from setting focus here + // when loading a url into blank window + setTimeout("SetFocusOnStartup()", 0); } if (!("InsertCharWindow" in window)) @@ -311,10 +313,6 @@ var gEditorDocumentObserver = controller.SetCommandRefCon(editor.QueryInterface(Components.interfaces.nsISupports)); } catch (e) {} } - - // udpate menu items now that we have an editor to play with - window.updateCommands("create"); - // Call EditorSetDefaultPrefsAndDoctype first so it gets the default author before initing toolbars EditorSetDefaultPrefsAndDoctype(); @@ -356,10 +354,6 @@ var gEditorDocumentObserver = item.hidden = true; } } - - // Unfortunately, we have to redo all command enabling - // that were done before we changed to "text" editing - window.updateCommands("create"); } // Set window title and build "Recent Files" menu @@ -403,6 +397,11 @@ var gEditorDocumentObserver = } } +function SetFocusOnStartup() +{ + gContentWindow.focus(); +} + function EditorStartup() { var is_HTMLEditor = IsHTMLEditor(); @@ -3200,3 +3199,4 @@ function FillInHTMLTooltip(tooltip) } return false; } +