Add support for 'Title' attribute in Image dialog. b=68800, r=brade, sr=hewitt

This commit is contained in:
cmanske%netscape.com 2002-09-03 23:37:58 +00:00
Родитель 4e1540d846
Коммит d9f86f2021
3 изменённых файлов: 47 добавлений и 14 удалений

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

@ -67,6 +67,7 @@ function ImageStartup()
gDialog.tabDimensions = document.getElementById( "imageDimensionsTab" ); gDialog.tabDimensions = document.getElementById( "imageDimensionsTab" );
gDialog.tabBorder = document.getElementById( "imageBorderTab" ); gDialog.tabBorder = document.getElementById( "imageBorderTab" );
gDialog.srcInput = document.getElementById( "srcInput" ); gDialog.srcInput = document.getElementById( "srcInput" );
gDialog.titleInput = document.getElementById( "titleInput" );
gDialog.altTextInput = document.getElementById( "altTextInput" ); gDialog.altTextInput = document.getElementById( "altTextInput" );
gDialog.altTextRadioGroup = document.getElementById( "altTextRadioGroup" ); gDialog.altTextRadioGroup = document.getElementById( "altTextRadioGroup" );
gDialog.altTextRadio = document.getElementById( "altTextRadio" ); gDialog.altTextRadio = document.getElementById( "altTextRadio" );
@ -104,6 +105,9 @@ function InitImage()
// Force loading of image from its source and show preview image // Force loading of image from its source and show preview image
LoadPreviewImage(); LoadPreviewImage();
if (globalElement.hasAttribute("title"))
gDialog.titleInput.value = globalElement.getAttribute("title");
var hasAltText = globalElement.hasAttribute("alt"); var hasAltText = globalElement.hasAttribute("alt");
var altText; var altText;
if (hasAltText) if (hasAltText)
@ -507,6 +511,8 @@ function ValidateImage()
var src = TrimString(gDialog.srcInput.value); var src = TrimString(gDialog.srcInput.value);
globalElement.setAttribute("src", src); globalElement.setAttribute("src", src);
globalElement.setAttribute("title", TrimString(gDialog.titleInput.value));
// Force user to enter Alt text only if "Alternate text" radio is checked // Force user to enter Alt text only if "Alternate text" radio is checked
// Don't allow just spaces in alt text // Don't allow just spaces in alt text
var alt = ""; var alt = "";

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

@ -43,28 +43,52 @@
accesskey="&locationEditField.accessKey;" accesskey="&locationEditField.accessKey;"
tooltiptext="&locationEditField.tooltip;" tooltiptext="&locationEditField.tooltip;"
/> />
<textbox id="srcInput" oninput="ChangeImageSrc();"/> <textbox id="srcInput" oninput="ChangeImageSrc();" tabindex="1"/>
<hbox> <hbox>
<checkbox <checkbox
id = "MakeRelativeCheckbox" id = "MakeRelativeCheckbox"
for = "srcInput"/> for = "srcInput"
tabindex="2"/>
<spacer flex="1"/> <spacer flex="1"/>
<!-- from EdDialogOverlay.xul --> <!-- from EdDialogOverlay.xul -->
<button id="ChooseFile"/> <button id="ChooseFile" tabindex="3"/>
</hbox> </hbox>
<spacer class="spacer"/> <spacer class="spacer"/>
<radiogroup id="altTextRadioGroup" flex="1"> <radiogroup id="altTextRadioGroup" flex="1">
<hbox align="center"> <grid>
<radio id = "altTextRadio" <columns><column/><column flex="1"/></columns>
label = "&altText.label;" <rows>
accesskey = "&altText.accessKey;" <row align="center">
oncommand = "SetAltTextDisabled(false);"/> <label
<textbox flex="1" style = "margin-left: 26px"
id = "altTextInput" control = "titleInput"
style = "min-width : 20em" accesskey = "&title.accessKey;"
tooltiptext="&altTextEditField.tooltip;" value ="&title.label;"
oninput = "SetAltTextDisabled(false);"/> tooltiptext="&title.tooltip;"
</hbox> for = "titleInput"/>
<textbox flex="1"
id = "titleInput"
class = "MinWidth20em"
tooltiptext="&title.tooltip;"
tabindex="4"/>
</row>
<row align="center">
<radio id = "altTextRadio"
label = "&altText.label;"
accesskey = "&altText.accessKey;"
tooltiptext="&altTextEditField.tooltip;"
oncommand = "SetAltTextDisabled(false);"
tabindex="5"/>
<textbox flex="1"
id = "altTextInput"
class = "MinWidth20em"
tooltiptext="&altTextEditField.tooltip;"
oninput = "SetAltTextDisabled(false);"
tabindex="6"/>
</row>
</rows>
</grid>
<radio id = "noAltTextRadio" <radio id = "noAltTextRadio"
label = "&noAltText.label;" label = "&noAltText.label;"
accesskey = "&noAltText.accessKey;" accesskey = "&noAltText.accessKey;"

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

@ -32,6 +32,9 @@
<!ENTITY locationEditField.label "Image Location:"> <!ENTITY locationEditField.label "Image Location:">
<!ENTITY locationEditField.accessKey "L"> <!ENTITY locationEditField.accessKey "L">
<!ENTITY locationEditField.tooltip "Type the image's filename or location"> <!ENTITY locationEditField.tooltip "Type the image's filename or location">
<!ENTITY title.label "Tooltip:">
<!ENTITY title.accessKey "T">
<!ENTITY title.tooltip "The html 'title' attribute that displays as a tooltip">
<!ENTITY altText.label "Alternate text:"> <!ENTITY altText.label "Alternate text:">
<!ENTITY altText.accessKey "A"> <!ENTITY altText.accessKey "A">
<!ENTITY altTextEditField.tooltip "Type text to display in place of the image"> <!ENTITY altTextEditField.tooltip "Type text to display in place of the image">