Part of fix to 'Fix right-click to edit link on an image', b=142042, r=neil@parkwaycc.co.uk, sr=alecf, a=asa/drivers

This commit is contained in:
cmanske%netscape.com 2002-07-24 03:47:01 +00:00
Родитель 7be0209a8f
Коммит 6a381c0e16
2 изменённых файлов: 19 добавлений и 5 удалений

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

@ -2000,7 +2000,7 @@ var nsQuitCommand =
isCommandEnabled: function(aCommand, dummy) isCommandEnabled: function(aCommand, dummy)
{ {
return true; // we can always do this return true; // we can always do this
}, }
/* The doCommand is not used, since cmd_quit's oncommand="goQuitApplication()" in platformCommunicatorOverlay.xul /* The doCommand is not used, since cmd_quit's oncommand="goQuitApplication()" in platformCommunicatorOverlay.xul
doCommand: function(aCommand) doCommand: function(aCommand)
@ -2392,7 +2392,13 @@ var nsLinkCommand =
}, },
doCommand: function(aCommand) doCommand: function(aCommand)
{ {
window.openDialog("chrome://editor/content/EdLinkProps.xul","_blank", "chrome,close,titlebar,modal"); // If selected element is an image, launch that dialog instead
// since last tab panel handles link around an image
var element = GetObjectForProperties();
if (element && element.nodeName.toLowerCase() == "img")
window.openDialog("chrome://editor/content/EdImageProps.xul","_blank", "chrome,close,titlebar,modal", null, true);
else
window.openDialog("chrome://editor/content/EdLinkProps.xul","_blank", "chrome,close,titlebar,modal");
window._content.focus(); window._content.focus();
} }
}; };

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

@ -38,6 +38,7 @@ function Startup()
gDialog.hrefInput = document.getElementById("hrefInput"); gDialog.hrefInput = document.getElementById("hrefInput");
gDialog.makeRelativeLink = document.getElementById("MakeRelativeLink"); gDialog.makeRelativeLink = document.getElementById("MakeRelativeLink");
gDialog.showLinkBorder = document.getElementById("showLinkBorder"); gDialog.showLinkBorder = document.getElementById("showLinkBorder");
gDialog.linkTab = document.getElementById("imageLinkTab");
// Get a single selected image element // Get a single selected image element
var tagName = "img"; var tagName = "img";
@ -45,8 +46,8 @@ function Startup()
{ {
imageElement = window.arguments[0]; imageElement = window.arguments[0];
// We've been called from form field propertes, so we can't insert a link // We've been called from form field propertes, so we can't insert a link
var imageLinkTab = document.getElementById('imageLinkTab'); gDialog.linkTab.parentNode.removeChild(gDialog.linkTab);
imageLinkTab.parentNode.removeChild(imageLinkTab); gDialog.linkTab = null;
} }
else else
{ {
@ -109,7 +110,14 @@ function Startup()
gDialog.widthUnitsMenulist.selectedIndex == 0 && gDialog.widthUnitsMenulist.selectedIndex == 0 &&
gDialog.heightUnitsMenulist.selectedIndex == 0; gDialog.heightUnitsMenulist.selectedIndex == 0;
SetTextboxFocus(gDialog.srcInput); // Start in "Link" tab if 2nd arguement is true
if (gDialog.linkTab && "arguments" in window && window.arguments[1])
{
document.getElementById("TabBox").selectedTab = gDialog.linkTab;
SetTextboxFocus(gDialog.hrefInput);
}
else
SetTextboxFocus(gDialog.srcInput);
SetWindowLocation(); SetWindowLocation();
} }