show tooltip for href (links), src (images) and name (named anchors) in Composer; b=47519, fix by glazman@netscape.com and neil@parkwaycc.co.uk, r=brade, r=glazman for kin's changes, sr=kin

This commit is contained in:
glazman%netscape.com 2002-11-08 09:14:00 +00:00
Родитель a33d330917
Коммит 16d402e795
2 изменённых файлов: 26 добавлений и 3 удалений

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

@ -3073,8 +3073,11 @@ function GetSelectionContainer()
var editor = GetCurrentEditor();
if (!editor) return null;
var selection = editor.selection;
if (!selection) return null;
try {
var selection = editor.selection;
if (!selection) return null;
}
catch (e) { return null; }
var result = { oneElementSelected:false };
@ -3139,3 +3142,20 @@ function GetSelectionContainer()
return result;
}
function FillInHTMLTooltip(tooltip)
{
var tooltipText = null;
for (var node = document.tooltipNode; node; node = node.parentNode) {
if (node instanceof Components.interfaces.nsIDOMHTMLImageElement ||
node instanceof Components.interfaces.nsIDOMHTMLInputElement)
tooltipText = node.getAttribute("src");
else if (node instanceof Components.interfaces.nsIDOMHTMLAnchorElement)
tooltipText = node.getAttribute("href") || node.name;
if (tooltipText) {
tooltip.setAttribute("label", tooltipText);
return true;
}
}
return false;
}

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

@ -97,6 +97,8 @@
<command id="toggleSidebar"/>
</commandset>
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(this);"/>
<broadcaster id="args" value="about:blank"/>
<broadcaster id="canPrint"/>
@ -245,7 +247,8 @@
which breaks deck frame-hiding mechanism
-->
<stack>
<editor type="content-primary" id="content-frame" src="about:blank" context="editorContentContext" flex="1"/>
<editor type="content-primary" id="content-frame" src="about:blank"
context="editorContentContext" flex="1" tooltip="aHTMLTooltip"/>
</stack>
<vbox>
<label id="doctype-text" crop="right"/>