From 052daafa8c5d421a0a6926c873b1042f08bff9db Mon Sep 17 00:00:00 2001 From: Ian Neal Date: Fri, 13 May 2011 21:21:27 +0100 Subject: [PATCH] Bug 655529 - Make use of contentAreaContext in message compose window r=neil --- suite/mailnews/compose/MsgComposeCommands.js | 30 ++++----- suite/mailnews/compose/messengercompose.xul | 49 ++------------- .../compose/msgComposeContextOverlay.xul | 63 +++++++++++++++++++ suite/mailnews/jar.mn | 1 + 4 files changed, 85 insertions(+), 58 deletions(-) create mode 100644 suite/mailnews/compose/msgComposeContextOverlay.xul diff --git a/suite/mailnews/compose/MsgComposeCommands.js b/suite/mailnews/compose/MsgComposeCommands.js index cd194b7ca2..f85057415d 100644 --- a/suite/mailnews/compose/MsgComposeCommands.js +++ b/suite/mailnews/compose/MsgComposeCommands.js @@ -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() diff --git a/suite/mailnews/compose/messengercompose.xul b/suite/mailnews/compose/messengercompose.xul index 6f5b44a945..c0327bd4e2 100644 --- a/suite/mailnews/compose/messengercompose.xul +++ b/suite/mailnews/compose/messengercompose.xul @@ -47,8 +47,9 @@ - + + @@ -190,54 +191,14 @@ + + - - - - - - - - - - - - - - - - - - - + context="contentAreaContextMenu"/> diff --git a/suite/mailnews/compose/msgComposeContextOverlay.xul b/suite/mailnews/compose/msgComposeContextOverlay.xul new file mode 100644 index 0000000000..3fda3bd155 --- /dev/null +++ b/suite/mailnews/compose/msgComposeContextOverlay.xul @@ -0,0 +1,63 @@ + + + + +%messengercomposeDTD; +]> + + + + + + + diff --git a/suite/mailnews/jar.mn b/suite/mailnews/jar.mn index 4ee745e9b7..591ce82081 100644 --- a/suite/mailnews/jar.mn +++ b/suite/mailnews/jar.mn @@ -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)