Fix bug 82139; ensure that Find-related items get disabled when in view source mode. r=brade, sr=kin

This commit is contained in:
sfraser%netscape.com 2001-05-23 00:23:03 +00:00
parent ce7d569925
commit e0bfe4c093
3 changed files with 12 additions and 6 deletions

View File

@ -570,7 +570,7 @@ var nsFindCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
return (window.editorShell != null);
return (window.editorShell && !IsInHTMLSourceMode());
},
doCommand: function(aCommand)
@ -586,7 +586,7 @@ var nsFindNextCommand =
{
// we can only do this if the search pattern is non-empty. Not sure how
// to get that from here
return (window.editorShell != null);
return (window.editorShell && !IsInHTMLSourceMode());
},
doCommand: function(aCommand)
@ -600,7 +600,7 @@ var nsReplaceCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
return (window.editorShell != null);
return (window.editorShell && !IsInHTMLSourceMode());
},
doCommand: function(aCommand)
@ -614,7 +614,7 @@ var nsSpellingCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
return (window.editorShell != null) && IsSpellCheckerInstalled();
return (window.editorShell != null) && !IsInHTMLSourceMode() && IsSpellCheckerInstalled();
},
doCommand: function(aCommand)

View File

@ -114,12 +114,18 @@ function IsEditorContentHTML()
return (editorShell.contentsMIMEType == "text/html");
}
function IsInHTMLSourceMode()
{
return (gEditorDisplayMode == DisplayModeSource);
}
// are we editing HTML (i.e. neither in HTML source mode, nor editing a text file)
function IsEditingRenderedHTML()
{
return IsEditorContentHTML() && (gEditorDisplayMode != DisplayModeSource);
return IsEditorContentHTML() && !IsInHTMLSourceMode();
}
// This is called when the real editor document is created,
// before it's loaded.
var DocumentStateListener =

View File

@ -140,7 +140,7 @@
<!-- edit menu commands. These get updated by code in globalOverlay.js -->
<commandset id="composerEditMenuItems"
commandupdater="true"
events="create"
events="create, mode_switch"
oncommandupdate="goUpdateComposerMenuItems(this)"
>
<command id="cmd_undo"/>