Bug 45495 gui for editing form elements r=glazman sr=alecf

git-svn-id: svn://10.0.0.236/trunk@142942 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
neil%parkwaycc.co.uk
2003-05-27 12:44:22 +00:00
parent 5dd2a2b2ac
commit b1ff8240af
23 changed files with 346 additions and 285 deletions

View File

@@ -61,6 +61,19 @@ table[empty-cells],
border: 1px dotted red;
}
/* give a green dashed border to forms otherwise they are invisible
*/
form
{
border: 2px dashed green;
}
/* give a green dotted border to labels otherwise they are invisible
*/
label
{
border: 1px dotted green;
}
/* smileys */
span.moz-smiley-s1,
span.moz-smiley-s2,

View File

@@ -20,6 +20,7 @@ MoreAttributes=More Attributes
FewerAttributes=Fewer Attributes
MoreProperties=More Properties
FewerProperties=Fewer Properties
PropertiesAccessKey=P
None=None
none=none
OpenHTMLFile=Open HTML File

View File

@@ -61,8 +61,10 @@ function Startup()
};
// Get a single selected button element
var tagName = "button";
buttonElement = editor.getSelectedElement(tagName);
const kTagName = "button";
try {
buttonElement = editor.getSelectedElement(kTagName);
} catch (e) {}
if (buttonElement)
// We found an element and don't need to insert one
@@ -73,8 +75,10 @@ function Startup()
// We don't have an element selected,
// so create one with default attributes
try {
buttonElement = editor.createElementWithDefaults(kTagName);
} catch (e) {}
buttonElement = editor.createElementWithDefaults(tagName);
if (!buttonElement)
{
dump("Failed to get selected element or create a new one!\n");
@@ -120,7 +124,7 @@ function InitDialog()
function RemoveButton()
{
RemoveElementKeepingChildren(buttonElement);
RemoveContainer(buttonElement);
SaveWindowLocation();
window.close();
}
@@ -158,10 +162,13 @@ function onAccept()
editor.cloneAttributes(buttonElement, globalElement);
if (insertNew && !InsertElementAroundSelection(buttonElement))
if (insertNew)
{
buttonElement.innerHTML = editor.outputToString("text/html", 1); // OutputSelectionOnly (see nsIDocumentEncoder.h)
editor.insertElementAtSelection(buttonElement, true);
if (!InsertElementAroundSelection(buttonElement))
{
buttonElement.innerHTML = editor.outputToString("text/html", 1); // OutputSelectionOnly (see nsIDocumentEncoder.h)
editor.insertElementAtSelection(buttonElement, true);
}
}
SaveWindowLocation();

View File

@@ -56,11 +56,11 @@
<broadcaster id="args" value=""/>
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<groupbox orient="vertical"><caption label="&Settings.label;"/>
<groupbox><caption label="&Settings.label;"/>
<grid><columns><column/><column/></columns>
<rows>
<row align="center">
<label value="&ButtonType.label;"/>
<label control="ButtonType" value="&ButtonType.label;" accesskey="&ButtonType.accesskey;"/>
<menulist id="ButtonType">
<menupopup>
<menuitem label="&submit.value;"/>
@@ -70,11 +70,11 @@
</menulist>
</row>
<row align="center">
<label value="&ButtonName.label;"/>
<label control="ButtonName" value="&ButtonName.label;" accesskey="&ButtonName.accesskey;"/>
<textbox id="ButtonName"/>
</row>
<row align="center">
<label value="&ButtonValue.label;"/>
<label control="ButtonValue" value="&ButtonValue.label;" accesskey="&ButtonValue.accesskey;"/>
<textbox id="ButtonValue"/>
</row>
</rows>
@@ -86,16 +86,16 @@
<rows>
<row>
<spacer/>
<checkbox id="ButtonDisabled" label="&ButtonDisabled.label;"/>
<checkbox id="ButtonDisabled" label="&ButtonDisabled.label;" accesskey="&ButtonDisabled.accesskey;"/>
</row>
<row align="center">
<label value="&tabIndex.label;"/>
<label control="ButtonTabIndex" value="&tabIndex.label;" accesskey="&tabIndex.accesskey;"/>
<hbox>
<textbox id="ButtonTabIndex" class="narrow" oninput="forceInteger(this.id);"/>
</hbox>
</row>
<row align="center">
<label value="&AccessKey.label;"/>
<label control="ButtonAccessKey" value="&AccessKey.label;" accesskey="&AccessKey.accesskey;"/>
<hbox>
<textbox id="ButtonAccessKey" class="narrow"/>
</hbox>
@@ -106,7 +106,7 @@
<!-- from EdDialogOverlay -->
<hbox flex="1" style="margin-top: 0.2em">
<button id="RemoveButton" label="&RemoveButton.label;" oncommand="RemoveButton();"/>
<button id="RemoveButton" label="&RemoveButton.label;" accesskey="&RemoveButton.accesskey;" oncommand="RemoveButton();"/>
<!-- This will right-align the button -->
<spacer flex="1"/>
<button id="AdvancedEditButton"/>

View File

@@ -390,6 +390,7 @@ function InitMoreFewer()
// onMoreFewer will toggle it and redraw the dialog
SeeMore = (gDialog.MoreFewerButton.getAttribute("more") != "1");
onMoreFewer();
gDialog.MoreFewerButton.setAttribute("accesskey",GetString("PropertiesAccessKey"));
}
function onMoreFewer()
@@ -781,199 +782,194 @@ var NotAnInlineParent = {
UL: true
};
function nodeDepth(node)
function nodeIsBreak(editor, node)
{
for (var depth = 0; node != null; depth++)
node = node.parentNode;
return depth;
return !node || node.localName == 'BR' || editor.nodeIsBlock(node);
}
function nthParent(node, n)
{
for (; n > 0; n--)
node = node.parentNode;
return node;
}
function nodeIsBlock(node)
{
// HR doesn't count because it's not a container
var editor = GetCurrentEditor();
return !editor || !node ||
(node.localName != 'HR' && editor.nodeIsBlock(node));
}
/* Ugly code alert! If only I could do this:
* var range = editor.selection.flattenRange(range); // ensure anchorNode == parentNode
* if (editor.isInlineRange(range) && editor.nodeIsBlock(node)) return false;
* while (!editor.containmentAllowed(range.anchorNode, element))
* range = editor.parentRangeOf(range);
* editor.insertNodeAtRange(element, range);
* return true;
*/
function InsertElementAroundSelection(element)
{
var editor = GetCurrentEditor();
editor.beginTransaction();
try {
// We need to find a suitable container for the element.
// First get the selection
var anchorParent = editor.selection.anchorNode;
if (!anchorParent.localName)
var anchorSelected = true;
else if (editor.selection.anchorOffset < anchorParent.childNodes.length)
var anchor = anchorParent.childNodes[editor.selection.anchorOffset];
var focusParent = editor.selection.focusNode;
if (!focusParent.localName)
var focusSelected = true;
else if (editor.selection.focusOffset < focusParent.childNodes.length)
var focus = focusParent.childNodes[editor.selection.focusOffset];
// Find the common ancestor
var anchorDepth = nodeDepth(anchorParent);
var focusDepth = nodeDepth(focusParent);
if (anchorDepth > focusDepth)
{
anchor = nthParent(anchorParent, anchorDepth - focusDepth - 1);
anchorParent = anchor.parentNode;
anchorSelected = true;
}
else if (anchorDepth < focusDepth)
{
focus = nthParent(focusParent, focusDepth - anchorDepth - 1);
focusParent = focus.parentNode;
focusSelected = true;
}
var ordered = false;
while (anchorParent != focusParent)
{
anchor = anchorParent;
anchorParent = anchor.parentNode;
focus = focusParent;
focusParent = focus.parentNode;
anchorSelected = focusSelected = true;
}
// The common ancestor may not be suitable, so find a suitable one.
if (editor.nodeIsBlock(element))
{
// Block element parent must be a valid block
while (!(anchorParent.localName in IsBlockParent))
{
anchor = focus = anchorParent;
anchorSelected = focusSelected = true;
anchorParent = anchor.parentNode;
ordered = true;
}
}
// First get the selection as a single range
var range, start, end, offset;
var count = editor.selection.rangeCount;
if (count == 1)
range = editor.selection.getRangeAt(0).cloneRange();
else
{
// Inline element parent must not be an invalid block
while (anchorParent.localName in NotAnInlineParent)
{
anchor = focus = anchorParent;
anchorSelected = focusSelected = true;
anchorParent = anchor.parentNode;
ordered = true;
}
range = editor.document.createRange();
start = editor.selection.getRangeAt(0)
range.setStart(start.startContainer, start.startOffset);
end = editor.selection.getRangeAt(--count);
range.setEnd(end.endContainer, end.endOffset);
}
// We now have an ancestor to hold the element
// and a range of child nodes to move into the element
if (anchor != focus)
// Flatten the selection to child nodes of the common ancestor
while (range.startContainer != range.commonAncestorContainer)
range.setStartBefore(range.startContainer);
while (range.endContainer != range.commonAncestorContainer)
range.setEndAfter(range.endContainer);
if (editor.nodeIsBlock(element))
// Block element parent must be a valid block
while (!(range.commonAncestorContainer.localName in IsBlockParent))
range.selectNode(range.commonAncestorContainer);
else
{
if (!ordered)
{
// Ensure anchor <= focus
for (var node = anchorParent.firstChild; node != anchor; node = node.nextSibling)
{
if (node == focus)
{
focus = anchor;
anchor = node;
focusSelected = anchorSelected;
// Fail if we're not inserting a block (use setInlineProperty instead)
if (!nodeIsBreak(editor, range.commonAncestorContainer))
return false;
else if (range.commonAncestorContainer.localName in NotAnInlineParent)
// Inline element parent must not be an invalid block
do range.selectNode(range.commonAncestorContainer);
while (range.commonAncestorContainer.localName in NotAnInlineParent);
else
// Further insert block check
for (var i = range.startOffset; ; i++)
if (i == range.endOffset)
return false;
else if (nodeIsBreak(editor, range.commonAncestorContainer.childNodes[i]))
break;
}
}
}
if (focus && !focusSelected)
focus = focus.previousSibling;
}
if (!editor.nodeIsBlock(element))
{
// Fail if we're not inserting a block
if (!anchor) return false;
for (node = anchor; ; node = node.nextSibling)
if (!node)
return false;
else if (nodeIsBlock(node))
break;
else if (node == focus)
return false;
}
// The range may be contained by body text, which should all be selected.
if (!nodeIsBlock(anchor))
while (!nodeIsBlock(anchor.previousSibling))
anchor = anchor.previousSibling;
if (!nodeIsBlock(focus))
while (!nodeIsBlock(focus.nextSibling))
focus = focus.nextSibling;
} catch (e) {return false;}
editor.beginTransaction();
try {
var anchorOffset = 0;
// Calculate the insertion point for the undoable insertNode method
if (!anchor)
anchor = anchorParent.firstChild;
else
for (node = anchorParent.firstChild; node != anchor; node = node.nextSibling)
anchorOffset++;
editor.insertNode(element, anchorParent, anchorOffset, true);
// Move all the old child nodes to the element
// Use editor methods in case of text nodes
while (anchor)
offset = range.startOffset;
start = range.startContainer.childNodes[offset];
if (!nodeIsBreak(editor, start))
{
node = anchor.nextSibling;
editor.deleteNode(anchor);
editor.insertNode(anchor, element, element.childNodes.length);
if (anchor == focus) break;
anchor = node;
while (!nodeIsBreak(editor, start.previousSibling))
{
start = start.previousSibling;
offset--;
}
}
end = range.endContainer.childNodes[range.endOffset];
if (end && !nodeIsBreak(editor, end.previousSibling))
{
while (!nodeIsBreak(editor, end))
end = end.nextSibling;
}
// Now insert the node
editor.insertNode(element, range.commonAncestorContainer, offset, true);
offset = element.childNodes.length;
if (!editor.nodeIsBlock(element))
editor.setShouldTxnSetSelection(false);
// Move all the old child nodes to the element
var empty = true;
while (start != end)
{
var next = start.nextSibling;
editor.deleteNode(start);
editor.insertNode(start, element, element.childNodes.length);
empty = false;
start = next;
}
if (!editor.nodeIsBlock(element))
editor.setShouldTxnSetSelection(true);
else
{
// Also move a trailing <br>
if (start && start.localName == 'BR')
{
editor.deleteNode(start);
editor.insertNode(start, element, element.childNodes.length);
empty = false;
}
// Still nothing? Insert a <br> so the node is not empty
if (empty)
editor.insertNode(editor.createElementWithDefaults("br"), element, element.childNodes.length);
// Hack to set the selection just inside the element
editor.insertNode(editor.document.createTextNode(""), element, offset);
}
}
catch (ex) {}
finally {
editor.endTransaction();
}
editor.endTransaction();
return true;
}
// Should I set the selection to the element, then insert HTML the element's innerHTML?
// I would prefer to say editor.deleteNode(element, FLAG_TO_KEEP_CHILD_NODES);
function RemoveElementKeepingChildren(element)
function nodeIsBlank(node)
{
return node && node.NODE_TYPE == Node.TEXT_NODE && !/\S/.test(node.data);
}
function nodeBeginsBlock(node)
{
while (nodeIsBlank(node))
node = node.nextSibling;
return nodeIsBlock(node);
}
function nodeEndsBlock(node)
{
while (nodeIsBlank(node))
node = node.previousSibling;
return nodeIsBlock(node);
}
// C++ function isn't exposed to JS :-(
function RemoveBlockContainer(element)
{
var editor = GetCurrentEditor();
editor.beginTransaction();
try {
editor.beginTransaction();
if (element.firstChild)
{
// Use editor methods in case of text nodes
var parent = element.parentNode;
var offset = 0;
for (var node = parent.firstChild; node != element; node = node.nextSibling)
offset++;
while ((node = element.firstChild))
{
editor.deleteNode(node);
editor.insertNode(node, parent, offset++);
}
var range = editor.document.createRange();
range.selectNode(element);
var offset = range.startOffset;
var parent = element.parentNode;
// May need to insert a break after the removed element
if (!nodeBeginsBlock(editor, element.nextSibling) &&
!nodeEndsBlock(editor, element.lastChild))
editor.insertNode(editor.createElementWithDefaults("br"), parent, range.endOffset);
// May need to insert a break before the removed element, or if it was empty
if (!nodeEndsBlock(editor, element.previousSibling) &&
!nodeBeginsBlock(editor, element.firstChild || element.nextSibling))
editor.insertNode(editor.createElementWithDefaults("br"), parent, offset++);
// Now remove the element
editor.deleteNode(element);
// Need to copy the contained nodes?
for (var i = 0; i < element.childNodes.length; i++)
editor.insertNode(element.childNodes[i].cloneNode(true), parent, offset++);
}
finally {
editor.endTransaction();
}
}
// C++ function isn't exposed to JS :-(
function RemoveContainer(element)
{
var editor = GetCurrentEditor();
editor.beginTransaction();
try {
var range = editor.document.createRange();
var parent = element.parentNode;
// Allow for automatic joining of text nodes
// so we can't delete the container yet
// so we need to copy the contained nodes
for (var i = 0; i < element.childNodes.length; i++) {
range.selectNode(element);
editor.insertNode(element.childNodes[i].cloneNode(true), parent, range.startOffset);
}
// Now remove the element
editor.deleteNode(element);
}
catch (ex) {}
editor.endTransaction();
finally {
editor.endTransaction();
}
}
function FillLinkMenulist(linkMenulist, headingsArray)

View File

@@ -62,9 +62,9 @@ function Startup()
// Find a selected fieldset, or if one is at start or end of selection.
fieldsetElement = editor.getSelectedElement(kTagName);
if (!fieldsetElement)
fieldsetElement = editor.getElementOrParentBykTagName(kTagName, editor.selection.anchorNode);
fieldsetElement = editor.getElementOrParentByTagName(kTagName, editor.selection.anchorNode);
if (!fieldsetElement)
fieldsetElement = editor.getElementOrParentBykTagName(kTagName, editor.selection.focusNode);
fieldsetElement = editor.getElementOrParentByTagName(kTagName, editor.selection.focusNode);
} catch (e) {}
if (fieldsetElement)
@@ -95,8 +95,7 @@ function Startup()
{
newLegend = false;
var range = editor.document.createRange();
range.setStart(legendElement, 0);
range.setEnd(legendElement, legendElement.childNodes.length);
range.selectNode(legendElement);
gDialog.legendText.value = range.toString();
if (/</.test(legendElement.innerHTML))
{
@@ -151,10 +150,8 @@ function RemoveFieldSet()
editor.beginTransaction();
try {
if (!newLegend)
editor.DeleteNode(legendElement);
// This really needs to call the C++ function RemoveBlockContainer
// which inserts any <BR>s needed
RemoveElementKeepingChildren(fieldsetElement);
editor.deleteNode(legendElement);
RemoveBlockContainer(fieldsetElement);
} finally {
editor.endTransaction();
}
@@ -184,9 +181,15 @@ function onAccept()
editor.cloneAttributes(legendElement, globalElement);
if (insertNew)
{
if (gDialog.legendText.value)
{
fieldsetElement.appendChild(legendElement);
legendElement.appendChild(editor.document.createTextNode(gDialog.legendText.value));
}
InsertElementAroundSelection(fieldsetElement);
if (gDialog.editText.checked)
}
else if (gDialog.editText.checked)
{
editor.setShouldTxnSetSelection(false);
@@ -199,7 +202,7 @@ function onAccept()
editor.insertNode(editor.document.createTextNode(gDialog.legendText.value), legendElement, 0);
}
else if (!newLegend)
editor.DeleteNode(legendElement);
editor.deleteNode(legendElement);
editor.setShouldTxnSetSelection(true);
}

View File

@@ -56,16 +56,16 @@
<broadcaster id="args" value=""/>
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<groupbox orient="vertical"><caption label="&Legend.label;"/>
<groupbox><caption label="&Legend.label;" accesskey="&Legend.accesskey;"/>
<grid><columns><column/><column/></columns>
<rows>
<row align="center">
<checkbox id="EditText" label="&EditLegendText.label;" checked="true" disabled="true"
<checkbox id="EditText" label="&EditLegendText.label;" accesskey="&EditLegendText.accesskey;" checked="true" disabled="true"
oncommand="gDialog.legendText.disabled = !gDialog.editText.checked;"/>
<textbox id="LegendText"/>
<textbox id="LegendText" accesskey="&Legend.accesskey;"/>
</row>
<row align="center">
<label value="&LegendAlign.label;"/>
<label control="LegendAlign" value="&LegendAlign.label;" accesskey="&LegendAlign.accesskey;"/>
<menulist id="LegendAlign">
<menupopup>
<menuitem label="&AlignDefault.label;"/>
@@ -81,7 +81,7 @@
<!-- from EdDialogOverlay -->
<hbox flex="1" style="margin-top: 0.2em">
<button id="RemoveFieldSet" label="&RemoveFieldSet.label;" oncommand="RemoveFieldSet();"/>
<button id="RemoveFieldSet" label="&RemoveFieldSet.label;" accesskey="&RemoveFieldSet.accesskey;" oncommand="RemoveFieldSet();"/>
<!-- This will right-align the button -->
<spacer flex="1"/>
<button id="AdvancedEditButton"/>

View File

@@ -44,6 +44,7 @@ function Startup()
var editor = GetCurrentEditor();
if (!editor)
{
dump("Failed to get active editor!\n");
window.close();
return;
}
@@ -60,12 +61,14 @@ function Startup()
gDialog.RemoveForm = document.getElementById("RemoveForm")
// Get a single selected form element
var tagName = "form";
formElement = editor.getSelectedElement(tagName);
if (!formElement)
formElement = editor.getElementOrParentByTagName(tagName, editor.selection.anchorNode);
if (!formElement)
formElement = editor.getElementOrParentByTagName(tagName, editor.selection.focusNode);
const kTagName = "form";
try {
formElement = editor.getSelectedElement(kTagName);
if (!formElement)
formElement = editor.getElementOrParentByTagName(kTagName, editor.selection.anchorNode);
if (!formElement)
formElement = editor.getElementOrParentByTagName(kTagName, editor.selection.focusNode);
} catch (e) {}
if (formElement)
{
@@ -80,8 +83,10 @@ function Startup()
// We don't have an element selected,
// so create one with default attributes
try {
formElement = editor.createElementWithDefaults(kTagName);
} catch (e) {}
formElement = editor.createElementWithDefaults(tagName);
if (!formElement)
{
dump("Failed to get selected element or create a new one!\n");
@@ -112,7 +117,7 @@ function InitDialog()
function RemoveForm()
{
RemoveElementKeepingChildren(formElement);
RemoveBlockContainer(formElement);
SaveWindowLocation();
window.close();
}

View File

@@ -56,19 +56,19 @@
<broadcaster id="args" value=""/>
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<groupbox orient="vertical"><caption label="&Settings.label;"/>
<groupbox><caption label="&Settings.label;"/>
<grid><columns><column/><column/></columns>
<rows>
<row align="center">
<label value="&FormName.label;"/>
<label control="FormName" value="&FormName.label;" accesskey="&FormName.accesskey;"/>
<textbox id="FormName"/>
</row>
<row align="center">
<label value="&FormAction.label;"/>
<label control="FormAction" value="&FormAction.label;" accesskey="&FormAction.accesskey;"/>
<textbox id="FormAction"/>
</row>
<row align="center">
<label value="&FormMethod.label;"/>
<label control="FormMethod" value="&FormMethod.label;" accesskey="&FormMethod.accesskey;"/>
<hbox>
<menulist id="FormMethod" editable="true" autoSelectMenuitem="true">
<menupopup>
@@ -83,7 +83,7 @@
</hbox>
<rows id="MoreSection">
<row align="center">
<label value="&FormEncType.label;"/>
<label control="FormEncType" value="&FormEncType.label;" accesskey="&FormEncType.accesskey;"/>
<menulist id="FormEncType" editable="true" autoSelectMenuitem="true">
<menupopup>
<menuitem label="application/x-www-form-urlencoded"/>
@@ -93,7 +93,7 @@
</menulist>
</row>
<row align="center">
<label value="&FormTarget.label;"/>
<label control="FormTarget" value="&FormTarget.label;" accesskey="&FormTarget.accesskey;"/>
<menulist id="FormTarget" editable="true" autoSelectMenuitem="true">
<menupopup>
<menuitem label="_blank"/>
@@ -110,7 +110,7 @@
<!-- from EdDialogOverlay -->
<hbox flex="1" style="margin-top: 0.2em">
<button id="RemoveForm" label="&RemoveForm.label;" oncommand="RemoveForm();"/>
<button id="RemoveForm" label="&RemoveForm.label;" accesskey="&RemoveForm.accesskey;" oncommand="RemoveForm();"/>
<!-- This will right-align the button -->
<spacer flex="1"/>
<button id="AdvancedEditButton"/>

View File

@@ -44,6 +44,7 @@ function Startup()
var editor = GetCurrentEditor();
if (!editor)
{
dump("Failed to get active editor!\n");
window.close();
return;
}
@@ -72,8 +73,10 @@ function Startup()
};
// Get a single selected input element
var tagName = "input";
inputElement = editor.getSelectedElement(tagName);
const kTagName = "input";
try {
inputElement = editor.getSelectedElement(kTagName);
} catch (e) {}
if (inputElement)
// We found an element and don't need to insert one
@@ -84,8 +87,10 @@ function Startup()
// We don't have an element selected,
// so create one with default attributes
try {
inputElement = editor.createElementWithDefaults(kTagName);
} catch (e) {}
inputElement = editor.createElementWithDefaults(tagName);
if (!inputElement)
{
dump("Failed to get selected element or create a new one!\n");

View File

@@ -56,7 +56,7 @@
<broadcaster id="args" value=""/>
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<groupbox orient="vertical"><caption label="&InputType.label;"/>
<groupbox><caption><label control="InputType" value="&InputType.label;" accesskey="&InputType.accesskey;"/></caption>
<menulist id="InputType" oncommand="SelectInputType();">
<menupopup>
<menuitem label="&text.value;"/>
@@ -73,29 +73,29 @@
</menulist>
</groupbox>
<groupbox orient="vertical"><caption label="&InputSettings.label;"/>
<groupbox><caption label="&InputSettings.label;"/>
<grid><columns><column/><column/></columns>
<rows>
<row align="center">
<deck id="InputNameDeck">
<label value="&InputName.label;"/>
<label value="&GroupName.label;"/>
<label control="InputName" value="&InputName.label;" accesskey="&Name.accesskey;"/>
<label control="InputName" value="&GroupName.label;" accesskey="&Name.accesskey;"/>
</deck>
<textbox id="InputName" oninput="onInput();"/>
</row>
<row align="center">
<deck id="InputValueDeck">
<label value="&InputValue.label;"/>
<label value="&InitialValue.label;"/>
<label control="InputValue" value="&InputValue.label;" accesskey="&Value.accesskey;"/>
<label control="InputValue" value="&InitialValue.label;" accesskey="&Value.accesskey;"/>
</deck>
<textbox id="InputValue" oninput="onInput();"/>
</row>
<row>
<spacer/>
<deck id="InputDeck" persist="index">
<checkbox id="InputChecked" label="&InputChecked.label;"/>
<checkbox id="InputSelected" label="&InputSelected.label;"/>
<checkbox id="InputReadOnly" label="&InputReadOnly.label;"/>
<checkbox id="InputChecked" label="&InputChecked.label;" accesskey="&InputChecked.accesskey;"/>
<checkbox id="InputSelected" label="&InputSelected.label;" accesskey="&InputSelected.accesskey;"/>
<checkbox id="InputReadOnly" label="&InputReadOnly.label;" accesskey="&InputReadOnly.accesskey;"/>
</deck>
</row>
</rows>
@@ -108,34 +108,34 @@
<rows>
<row>
<spacer/>
<checkbox id="InputDisabled" label="&InputDisabled.label;"/>
<checkbox id="InputDisabled" label="&InputDisabled.label;" accesskey="&InputDisabled.accesskey;"/>
</row>
<row align="center">
<label value="&tabIndex.label;"/>
<label control="InputTabIndex" value="&tabIndex.label;" accesskey="&tabIndex.accesskey;"/>
<hbox>
<textbox id="InputTabIndex" class="narrow" oninput="forceInteger(this.id);"/>
</hbox>
</row>
<row align="center">
<label value="&AccessKey.label;"/>
<label control="InputAccessKey" value="&AccessKey.label;" accesskey="&AccessKey.accesskey;"/>
<hbox>
<textbox id="InputAccessKey" class="narrow"/>
</hbox>
</row>
<row align="center">
<label value="&TextSize.label;"/>
<label control="InputSize" value="&TextSize.label;" accesskey="&TextSize.accesskey;"/>
<hbox>
<textbox id="InputSize" class="narrow" oninput="forceInteger(this.id);"/>
</hbox>
</row>
<row align="center">
<label value="&TextLength.label;"/>
<label control="InputMaxLength" value="&TextLength.label;" accesskey="&TextLength.accesskey;"/>
<hbox>
<textbox id="InputMaxLength" class="narrow" oninput="forceInteger(this.id);"/>
</hbox>
</row>
<row align="center">
<label value="&Accept.label;"/>
<label control="InputAccept" value="&Accept.label;" accesskey="&Accept.accesskey;"/>
<textbox id="InputAccept"/>
</row>
</rows>
@@ -148,7 +148,7 @@
<spacer flex="1"/>
<deck id="AdvancedEditDeck">
<button id="AdvancedEditButton"/>
<button label="&ImageProperties.label;" oncommand="doImageProperties();"/>
<button label="&ImageProperties.label;" accesskey="&ImageProperties.accesskey;" oncommand="doImageProperties();"/>
</deck>
</hbox>
<separator class="groove"/>

View File

@@ -60,10 +60,9 @@ function Startup()
InitDialog();
try {
editor.selectElement(labelElement);
gDialog.labelText.value = GetSelectionAsText();
} catch (e) {}
var range = editor.document.createRange();
range.selectNode(labelElement);
gDialog.labelText.value = range.toString();
if (/</.test(labelElement.innerHTML))
{
@@ -93,9 +92,7 @@ function onEditText()
function RemoveLabel()
{
// RemoveTextProperty might work
// but only because the label was selected to get its text
RemoveElementKeepingChildren(labelElement);
RemoveContainer(labelElement);
SaveWindowLocation();
window.close();
}
@@ -129,11 +126,8 @@ function onAccept()
while (labelElement.firstChild)
editor.deleteNode(labelElement.firstChild);
if (gDialog.labelText.value) {
var textNode = editor.document.createTextNode(gDialog.labelText.value);
editor.insertNode(textNode, labelElement, 0);
editor.selectElement(labelElement);
}
if (gDialog.labelText.value)
editor.insertNode(editor.document.createTextNode(gDialog.labelText.value), labelElement, 0);
editor.setShouldTxnSetSelection(true);
}

View File

@@ -56,20 +56,20 @@
<broadcaster id="args" value=""/>
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<groupbox orient="vertical"><caption label="&Settings.label;"/>
<groupbox><caption label="&Settings.label;" accesskey="&Settings.accesskey;"/>
<grid><columns><column/><column/></columns>
<rows>
<row align="center">
<checkbox id="EditText" label="&EditLabelText.label;" checked="true" disabled="true"
<checkbox id="EditText" label="&EditLabelText.label;" accesskey="&EditLabelText.accesskey;" checked="true" disabled="true"
oncommand="gDialog.labelText.disabled = !gDialog.editText.checked;"/>
<textbox id="LabelText"/>
<textbox id="LabelText" accesskey="&Settings.accesskey;"/>
</row>
<row align="center">
<label value="&LabelFor.label;"/>
<label control="LabelFor" value="&LabelFor.label;" accesskey="&LabelFor.accesskey;"/>
<textbox id="LabelFor"/>
</row>
<row align="center">
<label value="&AccessKey.label;"/>
<label control="LabelAccessKey" value="&AccessKey.label;" accesskey="&AccessKey.accesskey;"/>
<hbox>
<textbox id="LabelAccessKey" class="narrow"/>
</hbox>
@@ -80,7 +80,7 @@
<!-- from EdDialogOverlay -->
<hbox flex="1" style="margin-top: 0.2em">
<button id="RemoveLabel" label="&RemoveLabel.label;" oncommand="RemoveLabel();"/>
<button id="RemoveLabel" label="&RemoveLabel.label;" accesskey="&RemoveLabel.accesskey;" oncommand="RemoveLabel();"/>
<!-- This will right-align the button -->
<spacer flex="1"/>
<button id="AdvancedEditButton"/>

View File

@@ -270,7 +270,6 @@ optionObject.prototype.appendOption = function appendOption(child, parent)
// OPTGROUP element wrapper object
//
function optgroupObject(optgroup)
{
this.element = optgroup;

View File

@@ -75,25 +75,25 @@
<grid flex="1"><columns><column flex="1"/><column/></columns>
<rows>
<row align="center">
<label value="&SelectName.label;"/>
<label control="SelectName" value="&SelectName.label;" accesskey="&SelectName.accesskey;"/>
<textbox id="SelectName" flex="1" oninput="onNameInput();"/>
</row>
<row align="center">
<label value="&SelectSize.label;"/>
<label control="SelectSize" value="&SelectSize.label;" accesskey="&SelectSize.accesskey;"/>
<hbox>
<textbox id="SelectSize" class="narrow" oninput="forceInteger(this.id);"/>
</hbox>
</row>
<row>
<spacer/>
<checkbox id="SelectMultiple" flex="1" label="&SelectMultiple.label;" oncommand="onSelectMultipleClick();"/>
<checkbox id="SelectMultiple" flex="1" label="&SelectMultiple.label;" accesskey="&SelectMultiple.accesskey;" oncommand="onSelectMultipleClick();"/>
</row>
<row>
<spacer/>
<checkbox id="SelectDisabled" flex="1" label="&SelectDisabled.label;"/>
<checkbox id="SelectDisabled" flex="1" label="&SelectDisabled.label;" accesskey="&SelectDisabled.accesskey;"/>
</row>
<row align="center">
<label value="&SelectTabIndex.label;"/>
<label control="SelectTabIndex" value="&SelectTabIndex.label;" accesskey="&SelectTabIndex.accesskey;"/>
<hbox>
<textbox id="SelectTabIndex" class="narrow" oninput="forceInteger(this.id);"/>
</hbox>
@@ -106,12 +106,12 @@
<grid flex="1"><columns><column flex="1"/><column/></columns>
<rows>
<row align="center">
<label value="&OptGroupLabel.label;"/>
<label control="OptGroupLabel" value="&OptGroupLabel.label;" accesskey="&OptGroupLabel.accesskey;"/>
<textbox id="OptGroupLabel" oninput="onLabelInput();"/>
</row>
<row>
<spacer/>
<checkbox id="OptGroupDisabled" label="&OptGroupDisabled.label;"/>
<checkbox id="OptGroupDisabled" label="&OptGroupDisabled.label;" accesskey="&OptGroupDisabled.accesskey;"/>
</row>
</rows>
</grid>
@@ -121,20 +121,20 @@
<grid flex="1"><columns><column flex="1"/><column/></columns>
<rows>
<row align="center">
<label control="OptionText" value="&OptionText.label;"/>
<label control="OptionText" value="&OptionText.label;" accesskey="&OptionText.accesskey;"/>
<textbox id="OptionText" oninput="onTextInput();"/>
</row>
<row align="center">
<checkbox id="OptionHasValue" label="&OptionValue.label;" oncommand="onHasValueClick();"/>
<checkbox id="OptionHasValue" label="&OptionValue.label;" accesskey="&OptionValue.accesskey;" oncommand="onHasValueClick();"/>
<textbox id="OptionValue" oninput="onValueInput();"/>
</row>
<row>
<spacer/>
<checkbox id="OptionSelected" label="&OptionSelected.label;" oncommand="currentItem.cycleCell();"/>
<checkbox id="OptionSelected" label="&OptionSelected.label;" accesskey="&OptionSelected.accesskey;" oncommand="currentItem.cycleCell();"/>
</row>
<row>
<spacer/>
<checkbox id="OptionDisabled" label="&OptionDisabled.label;"/>
<checkbox id="OptionDisabled" label="&OptionDisabled.label;" accesskey="&OptionDisabled.accesskey;"/>
</row>
</rows>
</grid>
@@ -142,13 +142,13 @@
</deck>
<vbox>
<button label="&AddOption.label;" oncommand="AddOption();"/>
<button label="&AddOptGroup.label;" oncommand="AddOptGroup();"/>
<button id="RemoveButton" label="&RemoveElement.label;"
<button label="&AddOption.label;" accesskey="&AddOption.accesskey;" oncommand="AddOption();"/>
<button label="&AddOptGroup.label;" accesskey="&AddOptGroup.accesskey;" oncommand="AddOptGroup();"/>
<button id="RemoveButton" label="&RemoveElement.label;" accesskey="&RemoveElement.accesskey;"
oncommand="RemoveElement();" disabled="true"/>
<button id="PreviousButton" label="&MoveElementUp.label;"
<button id="PreviousButton" label="&MoveElementUp.label;" accesskey="&MoveElementUp.accesskey;"
oncommand="currentItem.moveUp();" disabled="true" type="row"/>
<button id="NextButton" label="&MoveElementDown.label;"
<button id="NextButton" label="&MoveElementDown.label;" accesskey="&MoveElementDown.accesskey;"
oncommand="currentItem.moveDown();" disabled="true" type="row"/>
<spacer flex="1"/>
<button id="AdvancedEditButton"/>

View File

@@ -53,36 +53,24 @@
<script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
<script type="application/x-javascript" src="chrome://editor/content/EdTextAreaProps.js"/>
<keyset>
<key key="&Settings.accessKey;" modifiers="alt" oncommand="SetTextboxFocus(gDialog.textareaName);"/>
<key key="&TextAreaName.accessKey;" modifiers="alt" oncommand="SetTextboxFocus(gDialog.textareaName);"/>
<key key="&TextAreaRows.accessKey;" modifiers="alt" oncommand="SetTextboxFocus(gDialog.textareaRows);"/>
<key key="&TextAreaCols.accessKey;" modifiers="alt" oncommand="SetTextboxFocus(gDialog.textareaCols);"/>
<key key="&TextAreaWrap.accessKey;" modifiers="alt" oncommand="gDialog.textareaWrap.focus();"/>
<key key="&TextAreaReadOnly.accessKey;" modifiers="alt" oncommand="gDialog.textareaReadOnly.focus();gDialog.textareaReadOnly.checked = !gDialog.textareaReadOnly.checked;"/>
<key key="&TextAreaDisabled.accessKey;" modifiers="alt" oncommand="gDialog.textareaDisabled.focus();gDialog.textareaDisabled.checked = !gDialog.textareaDisabled.checked;"/>
<key key="&TextAreaTabIndex.accessKey;" modifiers="alt" oncommand="SetTextboxFocus(gDialog.textareaTabIndex);"/>
<key key="&TextAreaAccessKey.accessKey;" modifiers="alt" oncommand="SetTextboxFocus(gDialog.textareaAccessKey);"/>
<key key="&InitialText.accessKey;" modifiers="alt" oncommand="gDialog.textareaValue.focus();"/>
</keyset>
<broadcaster id="args" value=""/>
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<groupbox orient="vertical"><caption label="&Settings.label;" accesskey="&Settings.accessKey;"/>
<groupbox><caption label="&Settings.label;"/>
<grid><columns><column/><column/></columns>
<rows>
<row align="center">
<label value="&TextAreaName.label;" accesskey="&TextAreaName.accessKey;"/>
<label control="TextAreaName" value="&TextAreaName.label;" accesskey="&TextAreaName.accessKey;"/>
<textbox id="TextAreaName" oninput="onInput();"/>
</row>
<row align="center">
<label value="&TextAreaRows.label;" accesskey="&TextAreaRows.accessKey;"/>
<label control="TextAreaRows" value="&TextAreaRows.label;" accesskey="&TextAreaRows.accessKey;"/>
<hbox>
<textbox id="TextAreaRows" class="narrow" oninput="forceInteger(this.id);onInput();"/>
</hbox>
</row>
<row align="center">
<label value="&TextAreaCols.label;" accesskey="&TextAreaCols.accessKey;"/>
<label control="TextAreaCols" value="&TextAreaCols.label;" accesskey="&TextAreaCols.accessKey;"/>
<hbox>
<textbox id="TextAreaCols" class="narrow" oninput="forceInteger(this.id);onInput();"/>
</hbox>
@@ -95,7 +83,7 @@
<grid id="MoreSection"><columns><column/><column/></columns>
<rows>
<row align="center">
<label value="&TextAreaWrap.label;" accesskey="&TextAreaWrap.accessKey;"/>
<label control="TextAreaWrap" value="&TextAreaWrap.label;" accesskey="&TextAreaWrap.accessKey;"/>
<menulist id="TextAreaWrap">
<menupopup>
<menuitem label="&WrapDefault.value;"/>
@@ -122,19 +110,19 @@
<checkbox id="TextAreaDisabled" label="&TextAreaDisabled.label;" accesskey="&TextAreaDisabled.accessKey;"/>
</row>
<row align="center">
<label value="&TextAreaTabIndex.label;" accesskey="&TextAreaTabIndex.accessKey;"/>
<label control="TextAreaTabIndex" value="&TextAreaTabIndex.label;" accesskey="&TextAreaTabIndex.accessKey;"/>
<hbox>
<textbox id="TextAreaTabIndex" class="narrow" oninput="forceInteger(this.id);"/>
</hbox>
</row>
<row align="center">
<label value="&TextAreaAccessKey.label;" accesskey="&TextAreaAccessKey.accessKey;"/>
<label control="TextAreaAccessKey" value="&TextAreaAccessKey.label;" accesskey="&TextAreaAccessKey.accessKey;"/>
<hbox>
<textbox id="TextAreaAccessKey" class="narrow" maxlength="1"/>
</hbox>
</row>
<row>
<label value="&InitialText.label;" accesskey="&InitialText.accessKey;"/>
<label control="TextAreaValue" value="&InitialText.label;" accesskey="&InitialText.accessKey;"/>
</row>
<textbox id="TextAreaValue" flex="1" multiline="true" rows="5"/>
</rows>

View File

@@ -39,14 +39,21 @@
<!ENTITY Settings.label "Settings">
<!ENTITY ButtonType.label "Type">
<!ENTITY ButtonType.accesskey "T">
<!ENTITY submit.value "Submit">
<!ENTITY reset.value "Reset">
<!ENTITY button.value "Button">
<!ENTITY ButtonName.label "Name:">
<!ENTITY ButtonName.accesskey "N">
<!ENTITY ButtonValue.label "Value:">
<!ENTITY ButtonValue.accesskey "V">
<!ENTITY tabIndex.label "Tab Index:">
<!ENTITY tabIndex.accesskey "I">
<!ENTITY ButtonDisabled.label "Disabled">
<!ENTITY ButtonDisabled.accesskey "D">
<!ENTITY AccessKey.label "Access Key:">
<!ENTITY AccessKey.accesskey "K">
<!ENTITY RemoveButton.label "Remove Button">
<!ENTITY RemoveButton.accesskey "R">

View File

@@ -37,12 +37,16 @@
<!ENTITY windowTitle.label "Field Set Properties">
<!ENTITY Legend.label "Legend">
<!ENTITY Legend.accesskey "L">
<!ENTITY EditLegendText.label "Edit Legend:">
<!ENTITY EditLegendText.accesskey "T">
<!ENTITY LegendAlign.label "Align Legend:">
<!ENTITY LegendAlign.accesskey "A">
<!ENTITY AlignDefault.label "Default">
<!ENTITY AlignLeft.label "Left">
<!ENTITY AlignCenter.label "Center">
<!ENTITY AlignRight.label "Right">
<!ENTITY RemoveFieldSet.label "Remove Field Set">
<!ENTITY RemoveFieldSet.accesskey "R">

View File

@@ -39,9 +39,15 @@
<!ENTITY Settings.label "Settings">
<!ENTITY FormName.label "Form Name:">
<!ENTITY FormName.accesskey "N">
<!ENTITY FormAction.label "Action URL:">
<!ENTITY FormAction.accesskey "A">
<!ENTITY FormMethod.label "Method:">
<!ENTITY FormMethod.accesskey "M">
<!ENTITY FormEncType.label "Encoding:">
<!ENTITY FormEncType.accesskey "c">
<!ENTITY FormTarget.label "Target Frame:">
<!ENTITY FormTarget.accesskey "T">
<!ENTITY RemoveForm.label "Remove Form">
<!ENTITY RemoveForm.accesskey "R">

View File

@@ -38,6 +38,7 @@
<!ENTITY windowTitleImage.label "Form Image Properties">
<!ENTITY InputType.label "Field Type">
<!ENTITY InputType.accesskey "T">
<!ENTITY text.value "Text">
<!ENTITY password.value "Password">
<!ENTITY checkbox.value "Check Box">
@@ -52,16 +53,28 @@
<!ENTITY InputSettings.label "Field Settings">
<!ENTITY InputName.label "Field Name:">
<!ENTITY GroupName.label "Group Name:">
<!ENTITY Name.accesskey "N">
<!ENTITY InputValue.label "Field Value:">
<!ENTITY InitialValue.label "Initial Value:">
<!ENTITY tabIndex.label "Tab Index:">
<!ENTITY InputDisabled.label "Disabled">
<!ENTITY Value.accesskey "V">
<!ENTITY InputChecked.label "Initially Checked">
<!ENTITY InputChecked.accesskey "C">
<!ENTITY InputSelected.label "Initially Selected">
<!ENTITY InputSelected.accesskey "S">
<!ENTITY InputReadOnly.label "Read Only">
<!ENTITY InputReadOnly.accesskey "R">
<!ENTITY InputDisabled.label "Disabled">
<!ENTITY InputDisabled.accesskey "D">
<!ENTITY tabIndex.label "Tab Index:">
<!ENTITY tabIndex.accesskey "I">
<!ENTITY TextSize.label "Field Size:">
<!ENTITY TextSize.accesskey "F">
<!ENTITY TextLength.label "Maximum Length:">
<!ENTITY TextLength.accesskey "L">
<!ENTITY AccessKey.label "Access Key:">
<!ENTITY AccessKey.accesskey "K">
<!ENTITY Accept.label "Accept Types:">
<!ENTITY Accept.accesskey "A">
<!ENTITY ImageProperties.label "Image Properties...">
<!ENTITY ImageProperties.accesskey "E">

View File

@@ -37,9 +37,14 @@
<!ENTITY windowTitle.label "Label Properties">
<!ENTITY Settings.label "Settings">
<!ENTITY Settings.accesskey "S">
<!ENTITY EditLabelText.label "Edit Text:">
<!ENTITY EditLabelText.accesskey "T">
<!ENTITY LabelFor.label "For Control:">
<!ENTITY LabelFor.accesskey "F">
<!ENTITY AccessKey.label "Access Key:">
<!ENTITY AccessKey.accesskey "K">
<!ENTITY RemoveLabel.label "Remove Label">
<!ENTITY RemoveLabel.accesskey "R">

View File

@@ -38,27 +38,43 @@
<!ENTITY Select.label "Selection List">
<!ENTITY SelectName.label "List Name:">
<!ENTITY SelectName.accesskey "N">
<!ENTITY SelectSize.label "Height:">
<!ENTITY SelectSize.accesskey "H">
<!ENTITY SelectMultiple.label "Multiple Selection">
<!ENTITY SelectMultiple.accesskey "M">
<!ENTITY SelectDisabled.label "Disabled">
<!ENTITY SelectDisabled.accesskey "D">
<!ENTITY SelectTabIndex.label "Tab Index:">
<!ENTITY SelectTabIndex.accesskey "I">
<!ENTITY OptGroup.label "Option Group">
<!ENTITY OptGroupLabel.label "Label:">
<!ENTITY OptGroupLabel.accesskey "L">
<!ENTITY OptGroupDisabled.label "Disabled">
<!ENTITY OptGroupDisabled.accesskey "D">
<!ENTITY Option.label "Option">
<!ENTITY OptionText.label "Text:">
<!ENTITY OptionText.accesskey "T">
<!ENTITY OptionValue.label "Value:">
<!ENTITY OptionValue.accesskey "V">
<!ENTITY OptionSelected.label "Initially Selected">
<!ENTITY OptionSelected.accesskey "S">
<!ENTITY OptionDisabled.label "Disabled">
<!ENTITY OptionDisabled.accesskey "D">
<!ENTITY TextHeader.label "Text">
<!ENTITY ValueHeader.label "Value">
<!ENTITY SelectedHeader.label "Selected">
<!ENTITY AddOption.label "Add Option">
<!ENTITY AddOption.accesskey "O">
<!ENTITY AddOptGroup.label "Add Group">
<!ENTITY AddOptGroup.accesskey "G">
<!ENTITY RemoveElement.label "Remove">
<!ENTITY RemoveElement.accesskey "R">
<!ENTITY MoveElementUp.label "Move Up">
<!ENTITY MoveElementUp.accesskey "U">
<!ENTITY MoveElementDown.label "Move Down">
<!ENTITY MoveElementDown.accesskey "D">

View File

@@ -37,7 +37,6 @@
<!ENTITY windowTitle.label "Text Area Properties">
<!ENTITY Settings.label "Settings">
<!ENTITY Settings.accessKey "S">
<!ENTITY TextAreaName.label "Field Name:">
<!ENTITY TextAreaName.accessKey "N">