Fix updating toolbar color after page color is changed, b=115694, r=syd, sr=hewitt

This commit is contained in:
cmanske%netscape.com 2002-01-05 20:40:05 +00:00
parent 95392cc913
commit 3549eafa09
2 changed files with 37 additions and 0 deletions

View File

@ -1661,6 +1661,7 @@ var nsColorPropertiesCommand =
doCommand: function(aCommand)
{
window.openDialog("chrome://editor/content/EdColorProps.xul","_blank", "chrome,close,titlebar,modal", "");
UpdateDefaultColors();
window._content.focus();
}
};

View File

@ -812,6 +812,42 @@ function onBackgroundColorChange()
}
}
// Call this when user changes text and/or background colors of the page
function UpdateDefaultColors()
{
var BrowserColors = GetDefaultBrowserColors();
var bodyelement = GetBodyElement();
var defTextColor = gDefaultTextColor;
var defBackColor = gDefaultBackgroundColor;
if (bodyelement)
{
var color = bodyelement.getAttribute("text");
if (color)
gDefaultTextColor = color;
else if (BrowserColors)
gDefaultTextColor = BrowserColors.TextColor;
color = bodyelement.getAttribute("bgcolor");
if (color)
gDefaultBackgroundColor = color;
else if (BrowserColors)
gDefaultBackgroundColor = BrowserColors.BackgroundColor;
}
// Trigger update on toolbar
if (defTextColor != gDefaultTextColor)
{
goUpdateCommand("cmd_fontColor");
onFontColorChange();
}
if (defBackColor != gDefaultBackgroundColor)
{
goUpdateCommand("cmd_backgroundColor");
onBackgroundColorChange();
}
}
function GetBackgroundElementWithColor()
{
gColorObj.Type = "";