fix some callers of editorshell's documentModified and documentEditable to use editor (bug 171798, r=cmanske, sr=alecf)

This commit is contained in:
brade%netscape.com 2002-10-01 18:43:04 +00:00
parent 6d7edf1540
commit b1308fc696

View File

@ -661,8 +661,9 @@ var nsSaveCommand =
// when you first open a remote file.
try {
var docUrl = GetDocumentUrl();
return window.editorShell && window.editorShell.documentEditable &&
(window.editorShell.documentModified || window.gHTMLSourceChanged ||
var editor = GetCurrentEditor();
return editor && editor.isDocumentEditable &&
(editor.documentModified || window.gHTMLSourceChanged ||
IsUrlAboutBlank(docUrl) || GetScheme(docUrl) != "file");
} catch (e) {return false;}
},
@ -781,7 +782,8 @@ var nsPublishCommand =
// when you first open any local file.
try {
var docUrl = GetDocumentUrl();
return window.editorShell.documentModified || window.gHTMLSourceChanged
var editor = GetCurrentEditor();
return editor.documentModified || window.gHTMLSourceChanged
|| IsUrlAboutBlank(docUrl) || GetScheme(docUrl) == "file";
} catch (e) {return false;}
}
@ -2132,8 +2134,9 @@ var nsRevertCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
return (window.editorShell && window.editorShell.documentEditable &&
window.editorShell.documentModified &&
var editor = GetCurrentEditor();
return (editor && editor.isDocumentEditable &&
editor.documentModified &&
!IsUrlAboutBlank(GetDocumentUrl()));
},
@ -2225,9 +2228,10 @@ var nsPreviewCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
return (window.editorShell && window.editorShell.documentEditable &&
var editor = GetCurrentEditor();
return (editor && editor.isDocumentEditable &&
isHTMLEditor() &&
(DocumentHasBeenSaved() || window.editorShell.documentModified));
(DocumentHasBeenSaved() || editor.documentModified));
},
getCommandStateParams: function(aCommand, aParams, aRefCon) {},
@ -2282,8 +2286,9 @@ var nsSendPageCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
return (window.editorShell != null && window.editorShell.documentEditable &&
(DocumentHasBeenSaved() || window.editorShell.documentModified));
var editor = GetCurrentEditor();
return (editor && editor.isDocumentEditable &&
(DocumentHasBeenSaved() || editor.documentModified));
},
getCommandStateParams: function(aCommand, aParams, aRefCon) {},
@ -2471,7 +2476,7 @@ var nsValidateCommand =
{
// If the document hasn't been modified,
// then just validate the current url.
if (editorShell.documentModified || gHTMLSourceChanged)
if (GetCurrentEditor().documentModified || gHTMLSourceChanged)
{
if (!CheckAndSaveDocument("cmd_validate", false))
return;