mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Make message compose use toolkit spellcheck UI b=355064 r=IanN,Mnyromyr
This commit is contained in:
parent
7ac7c45979
commit
e3b9e99c61
@ -251,8 +251,8 @@ var gComposeRecyclingListener = {
|
||||
document.getElementById("FormatToolbar").hidden = false;
|
||||
}
|
||||
|
||||
// Stop InlineSpellChecker so personal dictionary is saved
|
||||
StopInlineSpellChecker();
|
||||
// Stop InlineSpellCheckerUI so personal dictionary is saved
|
||||
InlineSpellCheckerUI.enabled = false;
|
||||
|
||||
//Reset editor
|
||||
EditorResetFontAndColorAttributes();
|
||||
@ -630,21 +630,20 @@ function updateComposeItems()
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function openEditorContextMenu()
|
||||
function openEditorContextMenu(popup)
|
||||
{
|
||||
// if we have a mispelled word, show spellchecker context
|
||||
// menuitems as well as the usual context menu
|
||||
var spellCheckNoSuggestionsItem = document.getElementById('spellCheckNoSuggestions');
|
||||
var word;
|
||||
var misspelledWordStatus = InlineSpellChecker.updateSuggestionsMenu(document.getElementById('msgComposeContext'),
|
||||
spellCheckNoSuggestionsItem, word);
|
||||
|
||||
var hideSpellingItems = (misspelledWordStatus == kSpellNoMispelling);
|
||||
spellCheckNoSuggestionsItem.hidden = hideSpellingItems || misspelledWordStatus != kSpellNoSuggestionsFound;
|
||||
document.getElementById('spellCheckAddToDictionary').hidden = hideSpellingItems;
|
||||
document.getElementById('spellCheckIgnoreWord').hidden = hideSpellingItems;
|
||||
document.getElementById('spellCheckAddSep').hidden = hideSpellingItems;
|
||||
document.getElementById('spellCheckSuggestionsSeparator').hidden = hideSpellingItems;
|
||||
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();
|
||||
}
|
||||
@ -1361,6 +1360,7 @@ function ComposeStartup(recycled, aParams)
|
||||
|
||||
// Do setup common to Message Composer and Web Composer
|
||||
EditorSharedStartup();
|
||||
InitLanguageMenu();
|
||||
}
|
||||
|
||||
var msgCompFields = gMsgCompose.compFields;
|
||||
@ -1548,8 +1548,8 @@ function ComposeUnload()
|
||||
{
|
||||
dump("\nComposeUnload from XUL\n");
|
||||
|
||||
// Stop InlineSpellChecker so personal dictionary is saved
|
||||
StopInlineSpellChecker();
|
||||
// Stop InlineSpellCheckerUI so personal dictionary is saved
|
||||
InlineSpellCheckerUI.enabled = false;
|
||||
|
||||
EditorCleanup();
|
||||
|
||||
@ -2099,7 +2099,7 @@ function SelectAddress()
|
||||
// walk through the recipients list and add them to the inline spell checker ignore list
|
||||
function addRecipientsToIgnoreList(aAddressesToAdd)
|
||||
{
|
||||
if (InlineSpellChecker.inlineSpellChecker && InlineSpellChecker.inlineSpellChecker.enableRealTimeSpell)
|
||||
if (InlineSpellCheckerUI.enabled)
|
||||
{
|
||||
// break the list of potentially many recipients back into individual names
|
||||
var hdrParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser);
|
||||
@ -2118,24 +2118,7 @@ function addRecipientsToIgnoreList(aAddressesToAdd)
|
||||
tokenizedNames = tokenizedNames.concat(splitNames);
|
||||
}
|
||||
|
||||
InlineSpellChecker.inlineSpellChecker.ignoreWords(tokenizedNames, tokenizedNames.length);
|
||||
}
|
||||
}
|
||||
|
||||
function StopInlineSpellChecker()
|
||||
{
|
||||
if (InlineSpellChecker.inlineSpellChecker)
|
||||
InlineSpellChecker.editor.setSpellcheckUserOverride(false);
|
||||
}
|
||||
|
||||
function ToggleInlineSpellChecker(target)
|
||||
{
|
||||
if (InlineSpellChecker.inlineSpellChecker)
|
||||
{
|
||||
InlineSpellChecker.editor.setSpellcheckUserOverride(!InlineSpellChecker.inlineSpellChecker.enableRealTimeSpell);
|
||||
|
||||
if (InlineSpellChecker.inlineSpellChecker.enableRealTimeSpell)
|
||||
InlineSpellChecker.checkDocument(window.content.document);
|
||||
InlineSpellCheckerUI.mInlineSpellChecker.ignoreWords(tokenizedNames, tokenizedNames.length);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2251,9 +2234,8 @@ function ChangeLanguage(event)
|
||||
sPrefs.setComplexValue("spellchecker.dictionary", nsISupportsString, str);
|
||||
|
||||
// now check the document over again with the new dictionary
|
||||
if (InlineSpellChecker.inlineSpellChecker)
|
||||
if (InlineSpellChecker.inlineSpellChecker.enableRealTimeSpell)
|
||||
InlineSpellChecker.checkDocument(window.content.document);
|
||||
if (InlineSpellCheckerUI.enabled)
|
||||
InlineSpellCheckerUI.mInlineSpellChecker.spellCheckRange(null);
|
||||
}
|
||||
event.stopPropagation();
|
||||
}
|
||||
@ -3341,11 +3323,7 @@ function AutoSave()
|
||||
function InitEditor(editor)
|
||||
{
|
||||
gMsgCompose.initEditor(editor, window.content);
|
||||
try {
|
||||
InlineSpellChecker.Init(editor, sPrefs.getBoolPref("mail.spellcheck.inline"));
|
||||
} catch (e) {
|
||||
// InlineSpellChecker.Init throws if there is no inline spellchecker
|
||||
// so disable menuitem.
|
||||
document.getElementById('menu_inlineSpellCheck').setAttribute('disabled', true);
|
||||
}
|
||||
InlineSpellCheckerUI.init(editor);
|
||||
InlineSpellCheckerUI.enabled = sPrefs.getBoolPref("mail.spellcheck.inline");
|
||||
document.getElementById("menu_inlineSpellCheck").setAttribute("disabled", !InlineSpellCheckerUI.canSpellCheck);
|
||||
}
|
||||
|
@ -94,7 +94,6 @@
|
||||
<script type="application/x-javascript" src="chrome://messenger/content/widgetglue.js"/>
|
||||
<script type="application/x-javascript" src="chrome://messenger/content/mail-offline.js"/>
|
||||
<script type="application/x-javascript" src="chrome://editor/content/editor.js"/>
|
||||
<script type="application/x-javascript" src="chrome://editor/content/editorInlineSpellCheck.js"/>
|
||||
<script type="application/x-javascript" src="chrome://messenger/content/messengercompose/MsgComposeCommands.js"/>
|
||||
|
||||
<!-- drag and drop -->
|
||||
@ -211,13 +210,13 @@
|
||||
|
||||
<popup id="sidebarPopup"/>
|
||||
|
||||
<popup id="msgComposeContext" onpopupshowing="openEditorContextMenu();">
|
||||
<popup 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="InlineSpellChecker.addToDictionary(null,null);"/>
|
||||
oncommand="InlineSpellCheckerUI.addToDictionary();"/>
|
||||
<menuitem id="spellCheckIgnoreWord" label="&spellCheckIgnoreWord.label;" accesskey="&spellCheckIgnoreWord.accesskey;"
|
||||
oncommand="InlineSpellChecker.ignoreWord(null, null)"/>
|
||||
oncommand="InlineSpellCheckerUI.ignoreWord()"/>
|
||||
<menuseparator id="spellCheckSuggestionsSeparator"/>
|
||||
|
||||
<menuitem label="&undo.label;" accesskey="&undo.accesskey;" command="cmd_undo"/>
|
||||
@ -342,7 +341,7 @@
|
||||
<menuitem label="&checkSpellingCmd.label;" id="menu_checkspelling" accesskey="&checkSpellingCmd.accesskey;" key="key_checkspelling" command="cmd_spelling"/>
|
||||
<menuitem label="&enableInlineSpellChecker.label;" id="menu_inlineSpellCheck"
|
||||
accesskey="&enableInlineSpellChecker.accesskey;" type="checkbox"
|
||||
oncommand="ToggleInlineSpellChecker(event.target)"/>
|
||||
oncommand="InlineSpellCheckerUI.enabled = !InlineSpellCheckerUI.enabled"/>
|
||||
<menuitem label=""eCmd.label;" accesskey=""eCmd.accesskey;" command="cmd_quoteMessage"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="returnReceiptMenu" type="checkbox" label="&returnReceiptMenu.label;" accesskey="&returnReceiptMenu.accesskey;" checked="false" oncommand="ToggleReturnReceipt(event.target)"/>
|
||||
|
Loading…
Reference in New Issue
Block a user