Bug 655529 - Make use of contentAreaContext in message compose window r=neil

This commit is contained in:
Ian Neal 2011-05-13 21:21:27 +01:00
Родитель 113e994312
Коммит 052daafa8c
4 изменённых файлов: 85 добавлений и 58 удалений

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

@ -628,20 +628,22 @@ function updateComposeItems()
function openEditorContextMenu(popup)
{
// if we have a mispelled word, show spellchecker context
// menuitems as well as the usual context menu
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.initFromEvent(document.popupRangeParent, document.popupRangeOffset);
var onMisspelling = InlineSpellCheckerUI.overMisspelling;
document.getElementById('spellCheckSuggestionsSeparator').hidden = !onMisspelling;
document.getElementById('spellCheckAddToDictionary').hidden = !onMisspelling;
document.getElementById('spellCheckIgnoreWord').hidden = !onMisspelling;
var separator = document.getElementById('spellCheckAddSep');
separator.hidden = !onMisspelling;
document.getElementById('spellCheckNoSuggestions').hidden = !onMisspelling ||
InlineSpellCheckerUI.addSuggestionsToMenu(popup, separator, 5);
updateEditItems();
gContextMenu = new nsContextMenu(popup);
if (gContextMenu.shouldDisplay)
{
// If message body context menu then focused element should be content.
var showPasteExtra =
top.document.commandDispatcher.focusedWindow == content;
gContextMenu.showItem("context-pasteNoFormatting", showPasteExtra);
gContextMenu.showItem("context-pasteQuote", showPasteExtra);
if (showPasteExtra)
{
goUpdateCommand("cmd_pasteNoFormatting");
goUpdateCommand("cmd_pasteQuote");
}
return true;
}
return false;
}
function updateEditItems()

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

@ -47,8 +47,9 @@
<?xul-overlay href="chrome://global/content/charsetOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/contentAreaContextOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/sidebar/sidebarOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/contentAreaContextOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/messengercompose/msgComposeContextOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/messengercompose/addressingWidgetOverlay.xul"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
@ -190,54 +191,14 @@
</keyset>
<keyset id="editorKeys"/>
<popupset id="contentAreaContextSet"/>
<popupset id="msgComposePopupSet">
<menupopup id="sidebarPopup"/>
<menupopup id="popupNotificationMenu"/>
<menupopup id="toolbar-context-menu"/>
<panel id="customizeToolbarSheetPopup"/>
<menupopup id="msgComposeContext"
onpopupshowing="openEditorContextMenu(this);">
<menuitem id="spellCheckNoSuggestions"
label="&spellCheckNoSuggestions.label;"
disabled="true"/>
<menuseparator id="spellCheckAddSep"/>
<menuitem id="spellCheckAddToDictionary"
label="&spellCheckAddToDictionary.label;"
accesskey="&spellCheckAddToDictionary.accesskey;"
oncommand="InlineSpellCheckerUI.addToDictionary();"/>
<menuitem id="spellCheckIgnoreWord"
label="&spellCheckIgnoreWord.label;"
accesskey="&spellCheckIgnoreWord.accesskey;"
oncommand="InlineSpellCheckerUI.ignoreWord()"/>
<menuseparator id="spellCheckSuggestionsSeparator"/>
<menuitem label="&undo.label;"
accesskey="&undo.accesskey;"
command="cmd_undo"/>
<menuseparator/>
<menuitem label="&cut.label;"
accesskey="&cut.accesskey;"
command="cmd_cut"/>
<menuitem label="&copy.label;"
accesskey="&copy.accesskey;"
command="cmd_copy"/>
<menuitem label="&paste.label;"
accesskey="&paste.accesskey;"
command="cmd_paste"/>
<menuitem command="cmd_pasteNoFormatting"/>
<menuitem label="&pasteQuote.label;"
accesskey="&pasteQuote.accesskey;"
command="cmd_pasteQuote"/>
<menuitem label="&delete.label;"
accesskey="&delete.accesskey;"
command="cmd_delete"/>
<menuseparator/>
<menuitem label="&selectAll.label;"
accesskey="&selectAll.accesskey;"
command="cmd_selectAll"/>
</menupopup>
<menupopup id="msgComposeAttachmentContext"
onpopupshowing="updateEditItems();">
<menuitem label="&openAttachment.label;"
@ -754,7 +715,7 @@
<!-- The mail message body frame -->
<vbox id="appcontent" flex="1">
<editor type="content-primary" id="content-frame" src="about:blank" name="browser.message.body" flex="1"
context="msgComposeContext"/>
context="contentAreaContextMenu"/>
</vbox>
</hbox>

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

@ -0,0 +1,63 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is SeaMonkey internet suite code.
The Initial Developer of the Original Code is
the SeaMonkey project at mozilla.org.
Portions created by the Initial Developer are Copyright (C) 2011
the Initial Developer. All Rights Reserved.
Contributor(s):
Ian Neal <iann_bugzilla@blueyonder.co.uk>
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK ***** -->
<!DOCTYPE overlay [
<!ENTITY % messengercomposeDTD SYSTEM "chrome://messenger/locale/messengercompose/messengercompose.dtd" >
%messengercomposeDTD;
]>
<overlay id="msgComposeContextOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menupopup id="contentAreaContextMenu"
onpopupshowing="return event.target != this ||
openEditorContextMenu(this);">
<!-- Hide the menuitems by default so they do not to show up
in the sidebar context menu. -->
<menuitem id="context-pasteNoFormatting"
insertafter="context-paste"
hidden="true"
command="cmd_pasteNoFormatting"/>
<menuitem id="context-pasteQuote"
insertafter="context-pasteNoFormatting"
label="&pasteQuote.label;"
accesskey="&pasteQuote.accesskey;"
hidden="true"
command="cmd_pasteQuote"/>
</menupopup>
</overlay>

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

@ -90,6 +90,7 @@ messenger.jar:
content/messenger/messengercompose/pref-formatting.xul (compose/prefs/pref-formatting.xul)
content/messenger/messengercompose/pref-formatting.js (compose/prefs/pref-formatting.js)
content/messenger/messengercompose/messengercompose.xul (compose/messengercompose.xul)
content/messenger/messengercompose/msgComposeContextOverlay.xul (compose/msgComposeContextOverlay.xul)
content/messenger/messengercompose/MsgComposeCommands.js (compose/MsgComposeCommands.js)
content/messenger/messengercompose/addressingWidgetOverlay.js (compose/addressingWidgetOverlay.js)
content/messenger/messengercompose/addressingWidgetOverlay.xul (compose/addressingWidgetOverlay.xul)