Fix for 28491 -- clicking list buttons should unlist correctly now, and some other minor cleanup. r=cmanske.

This commit is contained in:
sfraser%netscape.com 2000-04-05 00:06:13 +00:00
Родитель 2ca367c06d
Коммит 394ec85770
1 изменённых файлов: 15 добавлений и 42 удалений

Просмотреть файл

@ -44,15 +44,17 @@ var gStyleTags = {
const nsIFilePicker = Components.interfaces.nsIFilePicker; const nsIFilePicker = Components.interfaces.nsIFilePicker;
function EditorOnLoad() { function EditorOnLoad()
{
// See if argument was passed. // See if argument was passed.
if ( window.arguments && window.arguments[0] ) { if ( window.arguments && window.arguments[0] ) {
// Opened via window.openDialog with URL as argument. // Opened via window.openDialog with URL as argument.
// Put argument where EditorStartup expects it. // Put argument where EditorStartup expects it.
document.getElementById( "args" ).setAttribute( "value", window.arguments[0] ); document.getElementById( "args" ).setAttribute( "value", window.arguments[0] );
} }
// Continue with normal startup. // Continue with normal startup.
EditorStartup( 'html', document.getElementById("content-frame")); EditorStartup('html', document.getElementById("content-frame"));
// Active menu items that are initially hidden in XUL // Active menu items that are initially hidden in XUL
// because they are not needed by Messenger Composer // because they are not needed by Messenger Composer
@ -64,7 +66,8 @@ function EditorOnLoad() {
window.tryToClose = EditorClose; window.tryToClose = EditorClose;
} }
function TextEditorOnLoad() { function TextEditorOnLoad()
{
// See if argument was passed. // See if argument was passed.
if ( window.arguments && window.arguments[0] ) { if ( window.arguments && window.arguments[0] ) {
// Opened via window.openDialog with URL as argument. // Opened via window.openDialog with URL as argument.
@ -72,8 +75,7 @@ function TextEditorOnLoad() {
document.getElementById( "args" ).setAttribute( "value", window.arguments[0] ); document.getElementById( "args" ).setAttribute( "value", window.arguments[0] );
} }
// Continue with normal startup. // Continue with normal startup.
EditorStartup( 'text', document.getElementById("content-frame")); EditorStartup('text', document.getElementById("content-frame"));
return;
} }
// This is called when the real editor document is created, // This is called when the real editor document is created,
@ -93,13 +95,10 @@ var DocumentStateListener =
function EditorStartup(editorType, editorElement) function EditorStartup(editorType, editorElement)
{ {
dump("Doing Editor Startup...\n");
contentWindow = window.content; contentWindow = window.content;
dump("Trying to make an Editor Shell through the component manager...\n");
// store the editor shell in the window, so that child windows can get to it. // store the editor shell in the window, so that child windows can get to it.
var editorShell = window.editorShell = editorElement.editorShell; editorShell = editorElement.editorShell;
editorShell.Init(); editorShell.Init();
editorShell.SetWebShellWindow(window); editorShell.SetWebShellWindow(window);
@ -115,37 +114,12 @@ function EditorStartup(editorType, editorElement)
var url = document.getElementById("args").getAttribute("value"); var url = document.getElementById("args").getAttribute("value");
editorShell.LoadUrl(url); editorShell.LoadUrl(url);
dump("EditorAppCore windows have been set.\n");
// Set focus to the edit window // Set focus to the edit window
// This still doesn't work! // This still doesn't work!
// It works after using a toolbar button, however! // It works after using a toolbar button, however!
contentWindow.focus(); contentWindow.focus();
} }
function TestMenuCreation()
{
var menubar = document.getElementById("MainMenuBar");
var fileMenu = menubar.firstChild;
var filePopup = fileMenu.firstChild;
dump("File menu "+ fileMenu + "\n");
var newChild = document.createElement("menuitem");
newChild.setAttribute("value", "testing");
newChild.setAttribute("id", "testItem");
dump(newChild);
filePopup.appendChild(newChild);
// now try and find it
var someItem = document.getElementById("testItem");
if (!someItem)
dump("Failed to find new menu item\n");
}
function SetupToolbarElements()
{
}
function _EditorNotImplemented() function _EditorNotImplemented()
{ {
@ -155,7 +129,6 @@ function _EditorNotImplemented()
function EditorShutdown() function EditorShutdown()
{ {
dump("In EditorShutdown..\n"); dump("In EditorShutdown..\n");
//editorShell = XPAppCoresManager.Remove(editorShell);
} }
@ -490,7 +463,6 @@ function EditorSetDocumentCharacterSet(aCharset)
function EditorSetTextProperty(property, attribute, value) function EditorSetTextProperty(property, attribute, value)
{ {
editorShell.SetTextProperty(property, attribute, value); editorShell.SetTextProperty(property, attribute, value);
dump("Set text property -- calling focus()\n");
contentWindow.focus(); contentWindow.focus();
} }
@ -516,7 +488,7 @@ function onParagraphFormatChange()
var format = select.getAttribute("format"); var format = select.getAttribute("format");
if ( format == "mixed") if ( format == "mixed")
{ {
dump("Mixed paragraph format *******\n"); // dump("Mixed paragraph format *******\n");
// No single type selected // No single type selected
newIndex = -1; newIndex = -1;
} }
@ -1035,17 +1007,20 @@ function EditorMakeOrChangeList(listType)
// check the observer node, // check the observer node,
// which is the appropriate button // which is the appropriate button
var theButton = document.getElementById(listType + "Button"); var theButton = document.getElementById(listType + "Button");
dump("Toggling list " + listType + "\n");
if (theButton) if (theButton)
{ {
var isOn = theButton.getAttribute("toggled"); var buttonFormat = theButton.getAttribute("format");
var isOn = (listType == buttonFormat);
if (isOn == 1) if (isOn == 1)
{ {
dump("Removing list \n");
editorShell.RemoveList(listType); editorShell.RemoveList(listType);
} }
else else
{
editorShell.MakeOrChangeList(listType); editorShell.MakeOrChangeList(listType);
}
contentWindow.focus(); contentWindow.focus();
} }
@ -1057,7 +1032,6 @@ function EditorMakeOrChangeList(listType)
function EditorAlign(align) function EditorAlign(align)
{ {
dump("aligning\n");
editorShell.Align(align); editorShell.Align(align);
contentWindow.focus(); contentWindow.focus();
} }
@ -1581,7 +1555,6 @@ function onListFormatChange(listType)
theButton.setAttribute("toggled", 0); theButton.setAttribute("toggled", 0);
} }
} }
} }
function getColorAndSetColorWell(ColorPickerID, ColorWellID) function getColorAndSetColorWell(ColorPickerID, ColorWellID)