Home

# Class goog.ui.AbstractSpellChecker

Abstract base class for spell checker editor implementations. Provides basic functionality such as word lookup and caching.

extends goog.ui.Component

Instance Method Summary
| `blockReadyEvents()` Blocks processing of spell checker READY events. This is used in dictionary recharge and async mode so that completion is not signaled prematurely.
| `check()` Checks spelling for all text. Should be overridden by implementation.
| `continueAsyncProcessing() ⇒ ?goog.ui.AbstractSpellChecker.AsyncResult` Continues processing started by processTextAsync. Calls virtual processWord_ and processRange_ methods.
| `createWordElement_(string word, ?goog.spell.SpellCheck.WordStatus status) ⇒ ?HTMLSpanElement` Creates an element for a specified word and stores a reference to it.
| `disposeInternal()` Disposes of the component. Calls {@code exitDocument}, which is expected to remove event handlers and clean up the component. Propagates the call to the component's children, if any. Removes the component's DOM from the document unless it was decorated.
| `editWord_(?Element el, string old)` Edits a word.
| `finishAsyncProcessing()` Finalizes asynchronous processing mode. Should be called after there is no more text to process and processTextAsync and/or continueAsyncProcessing returned FINISHED.
| `getElementById(number id) ⇒ ?Element` Returns the span element that matches the given number id.
| `getElementProperties(?goog.spell.SpellCheck.WordStatus status) ⇒ ?Object` Returns desired element properties for the specified status. Should be overridden by implementation.
| `getHandler() ⇒ ?goog.spell.SpellCheck`
| `getSuggestions_() ⇒ ?Array.<string>` Retrieves the array of suggested spelling choices.
| `ignoreWord(string word)` Ignores spelling of word.
| `initSuggestionsMenu()` Initializes suggestions menu. Populates menu with separator and ignore option that are always valid. Suggestions are later added above the separator.
| `initializeAsyncMode()` Starts asynchronous processing mode.
| `isVisible() ⇒ boolean`
| `makeElementId(number= opt_id) ⇒ string` Generates unique Ids for spell checker elements.
| `onCorrectionAction(?goog.events.Event event)` Handles correction menu actions.
| `onWordChanged_(?goog.spell.SpellCheck.WordChangedEvent event)` Handles word change events and updates the word elements accordingly.
| `populateDictionary(string text, number words) ⇒ number` Precharges local dictionary cache. This is optional, but greatly reduces amount of subsequent churn in the DOM tree because most of the words become known from the very beginning.
| `processRange(?Node node, string text)` Processes range of text that checks out (contains no unrecognized words). Should be overridden by implementation. May contain words and separators.
| `processTextAsync(?Node node, string text) ⇒ ?goog.ui.AbstractSpellChecker.AsyncResult` Splits text into individual words and blocks of separators. Calls virtual processWord_ and processRange_ methods.
| `processWord(?Node node, string text, ?goog.spell.SpellCheck.WordStatus status)` Processes word. Should be overridden by implementation.
| `registerWordElement_(string word, ?HTMLSpanElement el)` Stores a reference to word element.
| `removeMarkup(?Element el)` Removes spell-checker markup and restore the node to text.
| `replaceWord(?Element el, string old, string word)` Replaces word.
| `resume()` Hides correction UI. Should be overridden by implementation.
| `setExcludeMarker((RegExp|null|string) marker)` Sets the marker for the excluded text. {@see goog.ui.AbstractSpellChecker.prototype.excludeMarker_}
| `setHandler(?goog.spell.SpellCheck handler)` Sets the handler used for caching and lookups.
| `showSuggestionsMenu(?Element el, (goog.events.BrowserEvent|goog.math.Coordinate|null=) opt_pos)` Displays suggestions menu.
| `unblockReadyEvents()` Unblocks processing of spell checker READY events. This is used in dictionary recharge and async mode so that completion is not signaled prematurely.
| `updateElement(?Element el, string word, ?goog.spell.SpellCheck.WordStatus status)` Updates element based on word status. Either converts it to a text node, or merges it with the previous or next text node if the status of the world is VALID, in which case the element itself is eliminated.

Static Method Summary
| `toInternalKey_(string word) ⇒ string` Converts a word to an internal key representation. This is necessary to avoid collisions with object's internal namespace. Only words that are reserved need to be escaped.