Fixed Advanced Editor dialog bugs (fixed warnings, user input filter rules, dynamic value menulist for particular attributes): bugs 86710, 86712, 86713, 86934, 88878, 88888, 88917, 88923, 88930, 88935, 89445, 92554 (includes help from stephend), r=brade (86713=rcassin, 92554=glazman), sr=kin; fix to 95085 by neil@parkwayscc.co.uk, r=cmanske, sr=kin

This commit is contained in:
cmanske%netscape.com 2001-08-17 22:41:52 +00:00
Родитель d023510f83
Коммит 1b897a579b
7 изменённых файлов: 164 добавлений и 44 удалений

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

@ -93,7 +93,7 @@ ShowToolbar=Show Toolbar
HideToolbar=Hide Toolbar
ImapError=Unable to load image
ImapCheck=\nPlease select a new location (URL) and try again.
ImapRelative=Relative URLs can only be used on documents which have been saved
SaveToUseRelativeUrl=Relative URLs can only be used on pages which have been saved
NoNamedAnchors=(No named anchors in this page)
NoHeadings=(No headings without anchors)
TextColor=Text Color

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

@ -21,7 +21,6 @@
* Beth Epperson
*/
// HTML Attributes object for "Name" menulist
var gHTMLAttr = {};
@ -40,6 +39,8 @@ var gCoreHTMLAttr =
// Core event attribute values //
// This is appended to all JS menulists
// except those elements having "noJSEvents"
// as a value in their gJSAttr array.
var gCoreJSEvents =
[
"onclick",
@ -111,6 +112,34 @@ var gVAlignTable =
];
// ================ HTML Attributes ================ //
/* For each element, there is an array of attributes,
whose name is the element name,
used to fill the "Attribute Name" menulist.
For each of those attributes, if they have a specific
set of values, those are listed in an array named:
"elementName_attName".
In each values string, the following characters
are signal to do input filtering:
"#" Allow only integer values
"%" Allow integer values or a number ending in "%"
"!" Allow only one character
"$" is an attribute required by HTML DTD
*/
/*
Most elements have the "dir" attribute,
so we use this value array
for all elements instead of specifying
separately for each element
*/
gHTMLAttr.all_dir =
[
"ltr",
"rtl"
];
gHTMLAttr.a =
[
"charset",
@ -211,11 +240,11 @@ gHTMLAttr.applet =
"object",
"alt",
"name",
"$width",
"$height",
"%$width",
"%$height",
"align",
"hspace",
"vspace",
"#hspace",
"#vspace",
"-",
"_core"
];
@ -286,6 +315,8 @@ gHTMLAttr.basefont_color = gHTMLColors;
gHTMLAttr.bdo =
[
"_core",
"-",
"lang",
"$dir"
];
@ -329,8 +360,6 @@ gHTMLAttr.body =
"dir"
];
gHTMLAttr.body_background = gHTMLColors;
gHTMLAttr.body_bgcolor = gHTMLColors;
gHTMLAttr.body_text = gHTMLColors;
@ -500,7 +529,11 @@ gHTMLAttr.dd =
gHTMLAttr.del =
[
"cite",
"datetime"
"datetime",
"_core",
"-",
"lang",
"dir"
];
gHTMLAttr.dfn =
@ -582,7 +615,7 @@ gHTMLAttr.fieldset =
// this is deprecated //
gHTMLAttr.font =
[
"size",
"#size",
"color",
"face",
"-",
@ -621,6 +654,13 @@ gHTMLAttr.form_enctype =
"application/x-www-form-urlencoded"
];
gHTMLAttr.form_target =
[
"blank",
"self",
"parent",
"top"
];
gHTMLAttr.frame =
[
@ -808,6 +848,15 @@ gHTMLAttr.iframe_scrolling =
"no"
];
gHTMLAttr.iframe_align =
[
"top",
"middle",
"bottom",
"left",
"right"
];
gHTMLAttr.img =
[
"$src",
@ -819,9 +868,9 @@ gHTMLAttr.img =
"usemap",
"ismap",
"align",
"border",
"hspace",
"vspace",
"#border",
"#hspace",
"#vspace",
"-",
"_core",
"-",
@ -1119,9 +1168,9 @@ gHTMLAttr.object =
"name",
"#tabindex",
"align",
"border",
"hspace",
"vspace",
"#border",
"#hspace",
"#vspace",
"-",
"_core",
"-",
@ -1677,7 +1726,9 @@ gHTMLAttr._var =
// ================ JS Attributes ================ //
// These are element specif even handlers.
// All elements use gCoreJSEvents
/* Most all elements use gCoreJSEvents, so those
are assumed except for those listed here with "noEvents"
*/
gJSAttr.a =
[
@ -1744,3 +1795,24 @@ gJSAttr.textarea =
"onchange"
];
// Elements that don't have JSEvents:
gJSAttr.font =
[
"noJSEvents"
];
gJSAttr.applet =
[
"noJSEvents"
];
gJSAttr.isindex =
[
"noJSEvents"
];
gJSAttr.iframe =
[
"noJSEvents"
];

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

@ -50,7 +50,7 @@ function BuildHTMLAttributeNameList()
var popup = dialog.AddHTMLAttributeNameInput.firstChild;
if (popup)
{
sep = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuseparator");
var sep = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuseparator");
if (sep)
popup.appendChild(sep);
}
@ -60,7 +60,7 @@ function BuildHTMLAttributeNameList()
// Get information about value filtering
forceOneChar = name.indexOf("!") >= 0;
forceInteger = name.indexOf("#") >= 0;
forceIntOrPercent = name.indexOf("%") >= 0;
var forceIntOrPercent = name.indexOf("%") >= 0;
//var required = name.indexOf("$") >= 0;
// Strip flag characters ("_" is used when attribute name is reserved JS word)
@ -176,14 +176,31 @@ function onInputHTMLAttributeName()
if (attName)
{
// Get value list for current attribute name
var valueList = gHTMLAttr[gElement.localName.toLowerCase() + "_" + attName];
var valueListName;
// Most elements have the "dir" attribute,
// so we have just one array for the allowed values instead
// requiring duplicate entries for each element in EdAEAttributes.js
if (attName == "dir")
valueListName = "all_dir";
else
valueListName = gElement.localName.toLowerCase() + "_" + attName;
// Strip off leading "_" we sometimes use (when element name is reserved word)
if (valueListName[0] == "_")
valueListName = valueListName.slice(1);
// Index to which widget we were using to edit the value
var deckIndex = dialog.AddHTMLAttributeValueDeck.getAttribute("index");
var newValue = "";
var listLen = 0;
if (valueList)
var deckIndex = 0;
if (valueListName in gHTMLAttr)
{
var valueList = gHTMLAttr[valueListName];
// Index to which widget we were using to edit the value
deckIndex = dialog.AddHTMLAttributeValueDeck.getAttribute("index");
listLen = valueList.length;
if (listLen > 0)
newValue = valueList[0];
@ -202,9 +219,23 @@ function onInputHTMLAttributeName()
}
// Rebuild the list
for (var i = 0; i < listLen; i++)
{
if (valueList[i] == "-")
{
// Signal for separator
var popup = dialog.AddHTMLAttributeValueInput.firstChild;
if (popup)
{
var sep = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuseparator");
if (sep)
popup.appendChild(sep);
}
} else {
AppendStringToMenulist(dialog.AddHTMLAttributeValueMenulist, valueList[i]);
}
}
}
}
if (listLen <= 1 && deckIndex != "0")
{

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

@ -26,13 +26,27 @@ function BuildJSEAttributeNameList()
ClearMenulist(dialog.AddJSEAttributeNameList);
// Get events specific to current element
var attNames = gJSAttr[gElement.localName.toLowerCase()];
var elementName = gElement.localName.toLowerCase();
if (elementName in gJSAttr)
{
var attNames = gJSAttr[elementName];
var i;
var popup;
var sep;
if (attNames && attNames.length)
{
// Since we don't allow user-editable JS events yet (but we will soon)
// simply remove the JS tab to not allow adding JS events
if (attNames[0] == "noJSEvents")
{
var tab = document.getElementById("tabJSE");
if (tab)
tab.parentNode.removeChild(tab);
return;
}
for (i = 0; i < attNames.length; i++)
AppendStringToMenulist(dialog.AddJSEAttributeNameList, attNames[i]);
@ -44,8 +58,9 @@ function BuildJSEAttributeNameList()
popup.appendChild(sep);
}
}
}
// Always add core JS events
// Always add core JS events unless we aborted above
for (i = 0; i < gCoreJSEvents.length; i++)
{
if (gCoreJSEvents[i] == "-")

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

@ -162,7 +162,7 @@ function UpdateExistingAttribute( attName, attValue, treeChildrenId )
{
var treeChildren = document.getElementById(treeChildrenId);
if (!treeChildren)
return;
return false;
var name;
var i;

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

@ -70,7 +70,7 @@
<tabs>
<tab label="&tabHTML.label;"/>
<tab label="&tabCSS.label;"/>
<tab label="&tabJSE.label;"/>
<tab label="&tabJSE.label;" id="tabJSE"/>
</tabs>
<tabpanels flex="1">
<!-- ============================================================== -->
@ -140,7 +140,7 @@
</treecolgroup>
<treehead>
<treerow>
<treecell class="treecell-header treecell-inset-header" label="&tree.attributeHeader.label;"/>
<treecell class="treecell-header treecell-inset-header" label="&tree.propertyHeader.label;"/>
<treecell class="treecell-header treecell-inset-header" label="&tree.valueHeader.label;"/>
</treerow>
</treehead>
@ -157,7 +157,7 @@
</columns>
<rows>
<row valign="bottom" equalsize="always">
<text class="label" for="AddCSSAttributeNameInput" value="&AttName.label;"/>
<text class="label" for="AddCSSAttributeNameInput" value="&PropertyName.label;"/>
<text class="label" for="AddCSSAttributeValueInput" value="&AttValue.label;"/>
</row>
<row valign="middle" equalsize="always">

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

@ -24,8 +24,10 @@
<!ENTITY WindowTitle.label "Advanced Property Editor">
<!ENTITY AttName.label "Attribute: ">
<!ENTITY AttValue.label "Value: ">
<!ENTITY PropertyName.label "Property: ">
<!ENTITY currentattributesfor.label "Current attributes for: ">
<!ENTITY tree.attributeHeader.label "Attribute">
<!ENTITY tree.propertyHeader.label "Property">
<!ENTITY tree.valueHeader.label "Value">
<!ENTITY tabHTML.label "HTML Attributes">
<!ENTITY tabCSS.label "Inline Style">