mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-20 17:20:54 +00:00
Fix 59707: extract navigator's context menu and allow it to be used elsewhere in the app (and to help in embedding). r=jag a=alecf
This commit is contained in:
parent
a3ad1c8493
commit
80f875c072
@ -849,11 +849,6 @@ function RevealSearchPanel()
|
||||
OpenBrowserWindow();
|
||||
}
|
||||
|
||||
function BrowserEditPage(url)
|
||||
{
|
||||
window.openDialog( "chrome://editor/content", "_blank", "chrome,all,dialog=no", url );
|
||||
}
|
||||
|
||||
//Note: BrowserNewEditorWindow() was moved to globalOverlay.xul and renamed to NewEditorWindow()
|
||||
|
||||
function BrowserOpenWindow()
|
||||
|
@ -29,6 +29,7 @@ Contributor(s): ______________________________________. -->
|
||||
<?xul-overlay href="chrome://communicator/content/sidebar/sidebarOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/securityOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/communicatorOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/contentAreaContextOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
|
||||
@ -62,14 +63,12 @@ Contributor(s): ______________________________________. -->
|
||||
<script type="text/javascript" src="chrome://global/content/nsClipboard.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/contentAreaClick.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/contentAreaDD.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/bookmarks/bookmarks.js"/>
|
||||
<script type="text/javascript" src="chrome://navigator/content/navigator.js"/>
|
||||
<script type="text/javascript" src="nsContextMenu.js"/>
|
||||
<script type="text/javascript" src="tooltip.js"/>
|
||||
<script type="text/javascript" src="navigatorDD.js"/>
|
||||
|
||||
<!-- UI services -->
|
||||
<script type="text/javascript" src="chrome://navigator/content/sessionHistoryUI.js"/>
|
||||
|
||||
@ -87,10 +86,8 @@ Contributor(s): ______________________________________. -->
|
||||
<broadcaster id="args" value=""/>
|
||||
<broadcaster id="cmd_pageSetup"/>
|
||||
</broadcasterset>
|
||||
|
||||
<!-- keys are appended from the overlay -->
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<!-- tooltips -->
|
||||
<popupset id="aTooltipSet"/>
|
||||
<!-- XXX-TEMP this needs to move into an XBL binding for browser!!! -->
|
||||
@ -105,164 +102,14 @@ Contributor(s): ______________________________________. -->
|
||||
<popup id="forwardMenu" oncreate="BrowserForwardMenu(event);" oncommand="gotoHistoryIndex(event);"/>
|
||||
</popupset>
|
||||
|
||||
<!-- Context menu -->
|
||||
<script language="javascript">
|
||||
// Global variable that holds the nsContextMenu instance.
|
||||
var contextMenu = null;
|
||||
</script>
|
||||
<popupset>
|
||||
<!-- This is the context menu for the content-area of the navigator
|
||||
window. It contains each and every possible menu choice. The
|
||||
appropriate items are hidden/shown upon display, based on what
|
||||
the user has clicked-on.
|
||||
-->
|
||||
<popup id="context"
|
||||
oncreate="contextMenu = new nsContextMenu( this ); return contextMenu.shouldDisplay;"
|
||||
ondestroy="contextMenu.onDestroy(); contextMenu = null;">
|
||||
|
||||
<!-- Open ==================================== -->
|
||||
<menuitem id="context-openlink"
|
||||
value="&openLinkCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.openLink();"/>
|
||||
<!-- XXX - DEPENDENT ON PRESENCE OF EDITOR!! - XXX -->
|
||||
<menuitem id="context-editlink"
|
||||
value="&editLinkCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.editLink();"/>
|
||||
<menuitem id="context-openframe"
|
||||
value="&openFrameCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.openFrame();"/>
|
||||
<menuitem id="context-showonlythisframe"
|
||||
value="&showOnlyThisFrameCmd.label;"
|
||||
accesskey="&showOnlyThisFrameCmd.accesskey;"
|
||||
oncommand="contextMenu.showOnlyThisFrame();"/>
|
||||
<menuseparator id="context-sep-open"/>
|
||||
<!-- Navigation ============================== -->
|
||||
<menuitem id="context-back"
|
||||
value="&goBackCmd.label;"
|
||||
accesskey="&goBackCmd.accesskey;"
|
||||
oncommand="BrowserBack()"/>
|
||||
<menuitem id="context-forward"
|
||||
value="&goForwardCmd.label;"
|
||||
accesskey="&goForwardCmd.accesskey;"
|
||||
oncommand="BrowserForward()"/>
|
||||
<menuitem id="context-reload"
|
||||
value="&reloadCmd.label;"
|
||||
accesskey="&reloadCmd.accesskey;"
|
||||
oncommand="BrowserReallyReload(event);"/>
|
||||
<menuitem id="context-reload-frame"
|
||||
value="&reloadFrameCmd.label;"
|
||||
accesskey="&reloadFrameCmd.accesskey;"
|
||||
oncommand="contextMenu.reloadFrame();"/>
|
||||
<menuitem id="context-stop"
|
||||
value="&stopCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="BrowserStop();"/>
|
||||
<menuseparator/>
|
||||
<!-- View ==================================== -->
|
||||
<menuitem id="context-viewsource"
|
||||
value="&viewPageSourceCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="BrowserViewSource();"/>
|
||||
<menuitem id="context-viewframesource"
|
||||
value="&viewFrameSourceCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.viewFrameSource();"/>
|
||||
<menuitem id="context-viewinfo"
|
||||
value="&viewPageInfoCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.viewInfo();"/>
|
||||
<menuitem id="context-viewframeinfo"
|
||||
value="&viewFrameInfoCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.viewFrameInfo();"/>
|
||||
<menuitem id="context-viewimage"
|
||||
value="&viewImageCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.viewImage();"/>
|
||||
<menuitem id="context-blockimage"
|
||||
value="&blockImageCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.blockImage();"/>
|
||||
<menuseparator id="context-sep-view"/>
|
||||
<!-- Misc ==================================== -->
|
||||
<menuitem id="context-bookmarkpage"
|
||||
value="&bookmarkPageCmd.label;"
|
||||
accesskey="&bookmarkPageCmd.accesskey;"
|
||||
oncommand="BrowserAddBookmark( window._content.location.href,
|
||||
window._content.document.title )"/>
|
||||
<menuitem id="context-bookmarklink"
|
||||
value="&bookmarkLinkCmd.label;"
|
||||
accesskey="&bookmarkLinkCmd.accesskey;"
|
||||
oncommand="BrowserAddBookmark( contextMenu.linkURL(),
|
||||
contextMenu.linkText() )"/>
|
||||
<menuseparator/>
|
||||
<!-- Save ==================================== -->
|
||||
<menuitem id="context-savepage"
|
||||
value="&savePageCmd.label;"
|
||||
accesskey="&savePageCmd.accesskey;"
|
||||
oncommand="contextMenu.savePage();"/>
|
||||
<menuitem id="context-saveframe"
|
||||
value="&saveFrameCmd.label;"
|
||||
accesskey="&saveFrameCmd.accesskey;"
|
||||
oncommand="contextMenu.saveFrame();"/>
|
||||
<menuitem id="context-savelink"
|
||||
value="&saveLinkCmd.label;"
|
||||
accesskey="&saveLinkCmd.accesskey;"
|
||||
oncommand="contextMenu.saveLink();"/>
|
||||
<menuitem id="context-saveimage"
|
||||
value="&saveImageCmd.label;"
|
||||
accesskey="&saveImageCmd.accesskey;"
|
||||
oncommand="contextMenu.saveImage();"/>
|
||||
<menuitem id="context-savebgimage"
|
||||
value="&saveBGImageCmd.label;"
|
||||
accesskey="&saveBGImageCmd.accesskey;"
|
||||
oncommand="contextMenu.saveBGImage();"/>
|
||||
<menuseparator id="context-sep-save"/>
|
||||
<!-- Clipboard =============================== -->
|
||||
<menuitem id="context-selectall"
|
||||
value="&selectAllCmd.label;"
|
||||
accesskey="&selectAllCmd.accesskey;"
|
||||
observes="cmd_selectAll"/>
|
||||
<menuitem id="context-cut"
|
||||
value="&cutCmd.label;"
|
||||
accesskey="&cutCmd.accesskey;"
|
||||
observes="cmd_cut"/>
|
||||
<menuitem id="context-copy"
|
||||
value="©Cmd.label;"
|
||||
accesskey="©Cmd.accesskey;"
|
||||
observes="cmd_copy"/>
|
||||
<menuitem id="context-paste"
|
||||
value="&pasteCmd.label;"
|
||||
accesskey="&pasteCmd.accesskey;"
|
||||
observes="cmd_paste"/>
|
||||
<menuitem id="context-capture"
|
||||
value="&captureCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.capture();"/>
|
||||
<menuitem id="context-prefill"
|
||||
value="&prefillCmd.label;"
|
||||
accesskey=""
|
||||
oncommand="contextMenu.prefill();"/>
|
||||
<menuitem id="context-copylink"
|
||||
value="©LinkCmd.label;"
|
||||
accesskey="©LinkCmd.accesskey;"
|
||||
oncommand="contextMenu.copyLink();"/>
|
||||
<menuitem id="context-copyimage"
|
||||
value="©ImageCmd.label;"
|
||||
accesskey="©ImageCmd.accesskey;"
|
||||
oncommand="contextMenu.copyImage();"/>
|
||||
</popup>
|
||||
</popupset>
|
||||
|
||||
<popupset>
|
||||
<popup id="contextual" oncreate="return fillContextMenu('contextual', 'innermostBox');" >
|
||||
<menu />
|
||||
</popup>
|
||||
</popupset>
|
||||
|
||||
<!-- context menu -->
|
||||
<popupset id="contentAreaContextSet"/>
|
||||
|
||||
<script language="javascript">
|
||||
var gBookmarkPopup = null;
|
||||
@ -449,7 +296,7 @@ Contributor(s): ______________________________________. -->
|
||||
|
||||
<!-- this box is temporary, pending XBLified <browser> -->
|
||||
<box id="browser" flex="1">
|
||||
<browser context="context" type="content-primary" id="content"
|
||||
<browser context="contentAreaContextMenu" type="content-primary" id="content"
|
||||
src="about:blank" flex="1" tooltip="aHTMLTooltip" onmouseover="if (throbberElement) EnableBusyCursor(throbberElement.getAttribute('busy') == 'true')"/>
|
||||
</box>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
- Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Blake Ross <BlakeR1234@aol.com>
|
||||
- Blake Ross <blakeross@telocity.com>
|
||||
- Peter Annema <disttsc@bart.nl>
|
||||
-->
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
%brandDTD;
|
||||
<!ENTITY % navigatorDTD SYSTEM "chrome://navigator/locale/navigator.dtd" >
|
||||
%navigatorDTD;
|
||||
<!ENTITY % contentAreaCommandsDTD SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
|
||||
%contentAreaCommandsDTD;
|
||||
]>
|
||||
|
||||
<overlay id="navigatorOverlay"
|
||||
@ -99,7 +101,7 @@
|
||||
<broadcaster id="Browser:OpenFile" value="&openFileCmd.label;" oncommand="BrowserOpenFileWindow();"/>
|
||||
<broadcaster id="cmd_close" oncommand="BrowserClose()"/>
|
||||
<broadcaster id="Browser:SavePage" value="&savePageCmd.label;" accesskey="&savePageCmd.accesskey;" oncommand="savePage();"/>
|
||||
<broadcaster id="Browser:EditPage" value="&editPageCmd.label;" oncommand="BrowserEditPage(window._content.location.href);"/>
|
||||
<broadcaster id="Browser:EditPage" value="&editPageCmd.label;" oncommand="editPage(window._content.location.href);"/>
|
||||
<broadcaster id="Browser:PrintSetup" value="&printSetupCmd.label;" disabled ="true" oncommand="BrowserReload();"/>
|
||||
<broadcaster id="Browser:PrintPreview" value="&printPreviewCmd.label;" disabled="true" oncommand="BrowserReload();"/>
|
||||
<broadcaster id="Browser:Print" value="&printCmd.label;" oncommand="BrowserPrint();"/>
|
||||
|
@ -37,21 +37,9 @@
|
||||
<!ENTITY printCmd.accesskey "p">
|
||||
<!ENTITY printCmd.commandkey "p">
|
||||
|
||||
<!ENTITY cutCmd.label "Cut">
|
||||
<!ENTITY cutCmd.accesskey "u">
|
||||
<!ENTITY copyCmd.label "Copy">
|
||||
<!ENTITY copyCmd.accesskey "c">
|
||||
<!ENTITY pasteCmd.label "Paste">
|
||||
<!ENTITY pasteCmd.accesskey "p">
|
||||
|
||||
<!ENTITY captureCmd.label "Save Form Data">
|
||||
<!ENTITY prefillCmd.label "Prefill Form">
|
||||
|
||||
<!ENTITY viewMenu.label "View">
|
||||
<!ENTITY viewMenu.accesskey "v">
|
||||
|
||||
<!ENTITY reloadCmd.commandkey "r">
|
||||
|
||||
<!ENTITY toolbarsCmd.label "Toolbars">
|
||||
<!ENTITY toolbarsCmd.accesskey "t">
|
||||
<!ENTITY navbarCmd.label "Navigation Toolbar">
|
||||
@ -76,12 +64,8 @@
|
||||
<!ENTITY useStyleSheetMenu.label "Use Stylesheet">
|
||||
<!ENTITY useStyleSheetMenu.accesskey "u">
|
||||
<!ENTITY useStyleSheetNone.label "None">
|
||||
<!ENTITY reloadCmd.label "Reload">
|
||||
<!ENTITY reloadCmd.accesskey "r">
|
||||
<!ENTITY showImagesCmd.label "Show Images">
|
||||
<!ENTITY showImagesCmd.accesskey "g">
|
||||
<!ENTITY stopCmd.label "Stop">
|
||||
<!ENTITY stopCmd.accesskey "s">
|
||||
<!ENTITY pageSourceCmd.label "Page Source">
|
||||
<!ENTITY pageSourceCmd.accesskey "o">
|
||||
<!ENTITY pageSourceCmd.commandkey "u">
|
||||
@ -140,10 +124,6 @@
|
||||
<!ENTITY searchInternetKeywords.accesskey "k">
|
||||
<!ENTITY goMenu.label "Go">
|
||||
<!ENTITY goMenu.accesskey "g">
|
||||
<!ENTITY goBackCmd.label "Back">
|
||||
<!ENTITY goBackCmd.accesskey "b">
|
||||
<!ENTITY goForwardCmd.label "Forward">
|
||||
<!ENTITY goForwardCmd.accesskey "f">
|
||||
<!ENTITY goHomeCmd.label "Home">
|
||||
<!ENTITY goHomeCmd.accesskey "h">
|
||||
|
||||
@ -310,52 +290,3 @@
|
||||
|
||||
<!-- Statusbar -->
|
||||
<!ENTITY statusText.label "Document: Done">
|
||||
|
||||
<!-- Context Menu -->
|
||||
<!ENTITY blockImageCmd.label "Block Image from Loading">
|
||||
<!ENTITY blockImageCmd.accesskey "k">
|
||||
<!ENTITY openLinkCmd.label "Open Link in New Window">
|
||||
<!ENTITY openLinkCmd.accesskey "o">
|
||||
<!ENTITY editLinkCmd.label "Edit Link in Composer">
|
||||
<!ENTITY editLinkCmd.accesskey "e">
|
||||
<!ENTITY openFrameCmd.label "Open Frame in New Window">
|
||||
<!ENTITY openFrameCmd.accesskey "o">
|
||||
<!ENTITY showOnlyThisFrameCmd.label "Show Only This Frame">
|
||||
<!ENTITY showOnlyThisFrameCmd.accesskey "w">
|
||||
<!ENTITY reloadCmd.accesskey "r">
|
||||
<!ENTITY reloadCmd.commandKey "r">
|
||||
<!ENTITY reloadFrameCmd.label "Reload Frame">
|
||||
<!ENTITY reloadFrameCmd.accesskey "r">
|
||||
<!ENTITY viewPageSourceCmd.label "View Page Source">
|
||||
<!ENTITY viewPageSourceCmd.accesskey "v">
|
||||
<!ENTITY viewFrameSourceCmd.label "View Frame Source">
|
||||
<!ENTITY viewFrameSourceCmd.accesskey "v">
|
||||
<!ENTITY viewPageInfoCmd.label "View Page Info">
|
||||
<!ENTITY viewPageInfoCmd.accesskey "i">
|
||||
<!ENTITY viewFrameInfoCmd.label "View Frame Info">
|
||||
<!ENTITY viewFrameInfoCmd.accesskey "i">
|
||||
<!ENTITY viewImageCmd.label "View Image">
|
||||
<!ENTITY viewImageCmd.accesskey "w">
|
||||
<!ENTITY bookmarkPageCmd.label "Bookmark this Page">
|
||||
<!ENTITY bookmarkPageCmd.accesskey "b">
|
||||
<!ENTITY bookmarkLinkCmd.label "Bookmark this Link">
|
||||
<!ENTITY bookmarkLinkCmd.accesskey "b">
|
||||
<!ENTITY savePageCmd.label "Save As...">
|
||||
<!ENTITY savePageCmd.accesskey "s">
|
||||
<!ENTITY savePageCmd.commandkey "s">
|
||||
<!ENTITY saveFrameCmd.label "Save Frame As...">
|
||||
<!ENTITY saveFrameCmd.accesskey "f">
|
||||
<!ENTITY saveLinkCmd.label "Save Link As...">
|
||||
<!ENTITY saveLinkCmd.accesskey "a">
|
||||
<!ENTITY saveImageCmd.label "Save Image As...">
|
||||
<!ENTITY saveImageCmd.accesskey "a">
|
||||
<!ENTITY saveBGImageCmd.label "Save Background Image As...">
|
||||
<!ENTITY saveBGImageCmd.accesskey "a">
|
||||
<!ENTITY copyCmd.label "Copy">
|
||||
<!ENTITY copyCmd.accesskey "c">
|
||||
<!ENTITY selectAllCmd.label "Select All">
|
||||
<!ENTITY selectAllCmd.accesskey "l">
|
||||
<!ENTITY copyLinkCmd.label "Copy Link Location">
|
||||
<!ENTITY copyLinkCmd.accesskey "n">
|
||||
<!ENTITY copyImageCmd.label "Copy Image Location">
|
||||
<!ENTITY copyImageCmd.accesskey "m">
|
||||
|
Loading…
x
Reference in New Issue
Block a user