Bug 207221 Autocomplete URL in [Image/]Link Properties dialog r=brade sr=rbs

This commit is contained in:
neil%parkwaycc.co.uk 2003-09-11 09:10:22 +00:00
parent 95a1a6cfe5
commit aa816e6f1f
2 changed files with 21 additions and 7 deletions

View File

@ -974,6 +974,7 @@ function RemoveContainer(element)
function FillLinkMenulist(linkMenulist, headingsArray)
{
var menupopup = linkMenulist.firstChild;
var editor = GetCurrentEditor();
try {
var NamedAnchorNodeList = editor.document.anchors;
@ -981,7 +982,7 @@ function FillLinkMenulist(linkMenulist, headingsArray)
if (NamedAnchorCount > 0)
{
for (var i = 0; i < NamedAnchorCount; i++)
linkMenulist.appendItem("#" + NamedAnchorNodeList.item(i).name);
createMenuItem(menupopup, "#" + NamedAnchorNodeList.item(i).name);
}
for (var j = 1; j <= 6; j++)
{
@ -1010,21 +1011,29 @@ function FillLinkMenulist(linkMenulist, headingsArray)
// Append "_" to any name already in the list
while (linkMenulist.getElementsByAttribute("label", text).length)
text += "_";
linkMenulist.appendItem(text);
createMenuItem(menupopup, text);
// Save nodes in an array so we can create anchor node under it later
headingsArray[text] = heading;
}
}
}
if (!linkMenulist.firstChild.hasChildNodes())
if (!menupopup.hasChildNodes())
{
var item = linkMenulist.appendItem(GetString("NoNamedAnchorsOrHeadings"));
var item = createMenuItem(menupopup, GetString("NoNamedAnchorsOrHeadings"));
item.setAttribute("disabled", "true");
}
} catch (e) {}
}
function createMenuItem(aMenuPopup, aLabel)
{
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", aLabel);
aMenuPopup.appendChild(menuitem);
return menuitem;
}
// Shared by Image and Link dialogs for the "Choose" button for links
function chooseLinkFile()
{

View File

@ -70,9 +70,14 @@
<vbox id="LinkLocationBox">
<label control="hrefInput" accesskey="&LinkURLEditField.accessKey;" width="1">&LinkURLEditField.label;</label>
<menulist editable="true" id="hrefInput" style="min-width: 30em" class="uri-element" oninput="ChangeLinkLocation();">
<menupopup/>
</menulist>
<textbox id="hrefInput" type="autocomplete"
searchSessions="history" timeout="50" maxrows="6"
disablehistory="false" class="uri-element"
oninput="ChangeLinkLocation();">
<menupopup class="autocomplete-history-popup"
popupalign="topleft" popupanchor="bottomleft"
oncommand="this.parentNode.value = event.target.getAttribute('label');"/>
</textbox>
<hbox align="center">
<!-- from EdDialogOverlay.xul 'for' identifies the textfield to get URL from -->
<checkbox id="MakeRelativeLink"