Bug 319315 r+a=ben Remove old spelling suggestions from context menu

This commit is contained in:
brettw%gmail.com 2006-04-26 23:37:45 +00:00
parent 3595b88dc7
commit 3453632baf
3 changed files with 20 additions and 8 deletions

View File

@ -37,7 +37,7 @@
<popup id="contentAreaContextMenu"
onpopupshowing="if (event.target != this) return true; gContextMenu = new nsContextMenu( this ); return gContextMenu.shouldDisplay;"
onpopuphiding="if (event.target == this) { gContextMenu.hiding(); gContextMenu = null; }">
onpopuphiding="if (event.target == this) { gContextMenu = null; }">
<menuitem id="spell-no-suggestions"
disabled="true"
label="&spellNoSuggestions.label;"/>

View File

@ -4436,11 +4436,6 @@ nsContextMenu.prototype = {
// Show if user clicked on something which has metadata.
this.showItem( "context-metadata", this.onMetaDataItem );
},
// called when the menu is going away
hiding : function() {
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu();
},
// Set various context menu attributes based on the state of the world.
setTarget : function ( node, event ) {
const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@ -4465,6 +4460,15 @@ nsContextMenu.prototype = {
this.inFrame = false;
this.hasBGImage = false;
this.bgImageURL = "";
// Clear any old spellchecking items from the menu, this used to
// be in the menu hiding code but wasn't getting called in all
// situations. Here, we can ensure it gets cleaned up any time the
// menu is shown. Note: must be before uninit because that clears the
// internal vars
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu();
InlineSpellCheckerUI.uninit();
// Remember the node that was clicked.

View File

@ -37,6 +37,14 @@
# ***** END LICENSE BLOCK *****
var InlineSpellCheckerUI = {
mOverMisspelling: false,
mMisspelling: "",
mMenu: null,
mSpellSuggestions: [], // text of words
mSuggestionItems: [], // menuitem nodes
mDictionaryMenu: null,
mDictionaryNames: [],
mDictionaryItems: [],
// Call this function to initialize for a given edit element
init: function(inputElt)
@ -58,8 +66,8 @@ var InlineSpellCheckerUI = {
this.mOverMisspelling = false;
this.mMisspelling = "";
this.mMenu = null;
this.mSpellSuggestions = []; // text of words
this.mSuggestionItems = []; // menuitem nodes
this.mSpellSuggestions = [];
this.mSuggestionItems = [];
this.mDictionaryMenu = null;
this.mDictionaryNames = [];
this.mDictionaryItems = [];