mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
Fixed focus problems and ability to remove background image, b=115858, r=neil@parkwaycc.co.uk, sr=hewitt
This commit is contained in:
parent
1f32e4f75e
commit
58dd9abb3a
@ -82,7 +82,7 @@ function ClearCSSInputWidgets()
|
||||
gDialog.AddCSSAttributeTree.clearSelection();
|
||||
gDialog.AddCSSAttributeNameInput.value ="";
|
||||
gDialog.AddCSSAttributeValueInput.value = "";
|
||||
gDialog.AddCSSAttributeNameInput.inputField.focus();
|
||||
SetTextboxFocus(gDialog.AddCSSAttributeNameInput);
|
||||
}
|
||||
|
||||
function onSelectCSSTreeItem()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user