Fixed focus problems and ability to remove background image, b=115858, r=neil@parkwaycc.co.uk, sr=hewitt

This commit is contained in:
cmanske%netscape.com 2002-02-19 05:29:57 +00:00
parent 1f32e4f75e
commit 58dd9abb3a
5 changed files with 21 additions and 30 deletions

View File

@ -82,7 +82,7 @@ function ClearCSSInputWidgets()
gDialog.AddCSSAttributeTree.clearSelection();
gDialog.AddCSSAttributeNameInput.value ="";
gDialog.AddCSSAttributeValueInput.value = "";
gDialog.AddCSSAttributeNameInput.inputField.focus();
SetTextboxFocus(gDialog.AddCSSAttributeNameInput);
}
function onSelectCSSTreeItem()

View File

@ -104,9 +104,6 @@ function BuildHTMLAttributeNameList()
}
}
}
// Always start with empty input fields
ClearHTMLInputWidgets();
}
// build attribute list in tree form from element attributes
@ -156,7 +153,7 @@ function ClearHTMLInputWidgets()
gDialog.AddHTMLAttributeTree.clearSelection();
gDialog.AddHTMLAttributeNameInput.value ="";
gDialog.AddHTMLAttributeValueInput.value = "";
gDialog.AddHTMLAttributeNameInput.inputField.focus();
SetTextboxFocus(gDialog.AddHTMLAttributeNameInput);
}
function onSelectHTMLTreeItem()

View File

@ -81,8 +81,6 @@ function BuildJSEAttributeNameList()
// Use current name and value of first tree item if it exists
onSelectJSETreeItem();
gDialog.AddJSEAttributeNameList.focus();
}
// build attribute list in tree form from element attributes

View File

@ -93,12 +93,11 @@ function Startup()
// Build attribute name arrays for menulists
BuildJSEAttributeNameList();
// No menulists for CSS panel (yet), so just clear input fields
ClearCSSInputWidgets();
// Do this last -- sets focus to HTML Name menulist
BuildHTMLAttributeNameList();
// No menulists for CSS panel (yet)
// Set focus to Name editable menulist in HTML panel
SetTextboxFocus(gDialog.AddHTMLAttributeNameInput);
// size the dialog properly
window.sizeToContent();

View File

@ -34,7 +34,7 @@
var BodyElement;
var prefs;
var backgroundImage;
var gBackgroundImage;
// Initialize in case we can't get them from prefs???
const defaultTextColor="#000000";
@ -116,17 +116,14 @@ function Startup()
function InitDialog()
{
// Get image from document
backgroundImage = GetHTMLOrCSSStyleValue(globalElement, backgroundStr, cssBackgroundImageStr);
var innerURL = backgroundImage.match( /url\((.*)\)/ ) ;
if (innerURL)
{
backgroundImage = RegExp.$1;
}
if (backgroundImage)
{
gDialog.BackgroundImageInput.value = backgroundImage;
gDialog.ColorPreview.setAttribute(styleStr, backImageStyle+backgroundImage+");");
}
gBackgroundImage = GetHTMLOrCSSStyleValue(globalElement, backgroundStr, cssBackgroundImageStr);
if (gBackgroundImage.match( /url\((.*)\)/ ))
gBackgroundImage = RegExp.$1;
gDialog.BackgroundImageInput.value = gBackgroundImage;
if (gBackgroundImage)
gDialog.ColorPreview.setAttribute(styleStr, backImageStyle+gBackgroundImage+");");
SetRelativeCheckbox();
@ -254,8 +251,8 @@ function SetColorPreview(ColorWellID, color)
case "backgroundCW":
// Must combine background color and image style values
var styleValue = backColorStyle+color;
if (backgroundImage)
styleValue += ";"+backImageStyle+backgroundImage+");";
if (gBackgroundImage)
styleValue += ";"+backImageStyle+gBackgroundImage+");";
gDialog.ColorPreview.setAttribute(styleStr,styleValue);
previewBGColor = color;
@ -352,13 +349,13 @@ function ValidateAndPreviewImage(ShowErrorMessage)
var image = TrimString(gDialog.BackgroundImageInput.value);
if (image)
{
backgroundImage = image;
gBackgroundImage = image;
// Display must use absolute URL if possible
var displayImage = gHaveDocumentUrl ? MakeAbsoluteUrl(image) : image;
styleValue += backImageStyle+displayImage+");";
}
else backgroundImage = null;
else gBackgroundImage = null;
// Set style on preview (removes image if not valid)
gDialog.ColorPreview.setAttribute(styleStr, styleValue);
@ -403,8 +400,8 @@ function ValidateData()
if (ValidateAndPreviewImage(true))
{
// A valid image may be null for no image
if (backgroundImage)
globalElement.setAttribute(backgroundStr, backgroundImage);
if (gBackgroundImage)
globalElement.setAttribute(backgroundStr, gBackgroundImage);
else
globalElement.removeAttribute(backgroundStr);