Changed AppendFilters when loading into Composer to favor HTML and TXT over 'All Files'. b=43834, r=brade, a=law

This commit is contained in:
cmanske%netscape.com 2000-06-27 23:55:12 +00:00
parent f637131411
commit 5734dfa3be
2 changed files with 19 additions and 9 deletions

View File

@ -89,6 +89,7 @@ function SetupControllerCommands()
gComposerCommandManager.registerCommand("cmd_DeleteCellContents", nsDeleteTableCellContentsCommand);
gComposerCommandManager.registerCommand("cmd_tableJoinCells", nsJoinTableCellsCommand);
gComposerCommandManager.registerCommand("cmd_tableSplitCell", nsSplitTableCellCommand);
gComposerCommandManager.registerCommand("cmd_NormalizeTable", nsNormalizeTableCommand);
}
//-----------------------------------------------------------------------------------
@ -171,9 +172,12 @@ var nsOpenCommand =
var fp = Components.classes["component://mozilla/filepicker"].createInstance(nsIFilePicker);
fp.init(window, window.editorShell.GetString("OpenHTMLFile"), nsIFilePicker.modeOpen);
// While we include "All", include filters that prefer HTML and Text files
fp.appendFilters(nsIFilePicker.filterText | nsIFilePicker.filterHTML | nsIFilePicker.filterAll);
// When loading into Composer, direct user to prefer HTML files and text files,
// so we call separately to control the order of the filter list
fp.appendFilters(nsIFilePicker.filterHTML);
fp.appendFilters(nsIFilePicker.filterText);
fp.appendFilters(nsIFilePicker.filterAll);
/* doesn't handle *.shtml files */
try {
fp.show();
@ -822,7 +826,7 @@ var nsSelectTableCellCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
return IsInTableCell();
return IsInTableCell();
},
doCommand: function(aCommand)
{
@ -986,7 +990,7 @@ var nsDeleteTableRowCommand =
{
if (this.isCommandEnabled(aCommand))
{
window.editorShell.DeleteTableRow(1);
window.editorShell.DeleteTableRow(1);
window._content.focus();
}
}
@ -1040,6 +1044,7 @@ var nsDeleteTableCellContentsCommand =
}
};
//-----------------------------------------------------------------------------------
var nsNormalizeTableCommand =
{
@ -1051,7 +1056,8 @@ var nsNormalizeTableCommand =
{
if (this.isCommandEnabled(aCommand))
{
window.editorShell.NormalizeTable();
// Use nsnull to let editor find table enclosing current selection
window.editorShell.NormalizeTable(null);
window._content.focus();
}
}
@ -1084,7 +1090,6 @@ var nsJoinTableCellsCommand =
if (this.isCommandEnabled(aCommand))
{
window.editorShell.JoinTableCells();
dump(editorShell+" **** CAN WE ACCESS GLOBAL editorShell:???\n");
window._content.focus();
}
}

View File

@ -118,9 +118,14 @@ function onChooseFile()
var fp = Components.classes["component://mozilla/filepicker"].createInstance(nsIFilePicker);
fp.init(window, bundle.GetStringFromName("chooseFileDialogTitle"), nsIFilePicker.modeOpen);
// When loading into Composer, direct user to prefer HTML files and text files:
if (dialog.openAppList.data == "2")
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText | nsIFilePicker.filterAll);
{
// When loading into Composer, direct user to prefer HTML files and text files,
// so we call separately to control the order of the filter list
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText);
fp.appendFilters(nsIFilePicker.filterText);
fp.appendFilters(nsIFilePicker.filterAll);
}
else
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);