dojox/editor/plugins/SpellCheck (version 1.10)

dijit/_editor/_Plugin

Summary

This plugin provides a spelling check capability for the editor.

Usage

var foo = new SpellCheck();
dojox/editor/plugins/SpellCheck

See the dojox/editor/plugins/SpellCheck reference documentation for more information.

Property Summary

  • _cursorSelectorThe CSS selector of the cursor span
  • _cursorSpanThe span that holds the current position of the cursor
  • _editorThe reference to the editor the plug-in belongs to.
  • _highlightedIncorrectStyleThe style of the highlighted incorrect words
  • _ignoredIncorrectStyleThe style of the ignored incorrect words
  • _incorrectWordsSpanThe wrapper that marks the incorrect words
  • _maxItemNumberThe max number of the suggestion list items
  • _normalIncorrectStyleThe style of the marked incorrect words.
  • _selectorAn empty CSS class that identifies the incorrect words
  • bufferLengthThe max length of each XHR request.
  • buttonThe button displayed on the editor's toolbar
  • commandString like "insertUnorderedList", "outdent", "justifyCenter", etc. that represents an editor command.
  • disabledFlag to indicate if this plugin has been disabled and should do nothing helps control button state, among other things.
  • editorPoints to the parent editor
  • exArgsThe object that holds all the parametes passed into the constructor
  • iconClassPrefixThe CSS class name for the button node is formed from iconClassPrefix and command
  • interactiveIndicate if the interactive spelling check is enabled
  • timeoutThe minutes to waiting for the response.
  • urlThe url of the spelling check service
  • useDefaultCommandIf true, this plugin executes by calling Editor.execCommand() with the argument specified in command.

Method Summary

  • _add() Add the unrecognized word into the dictionary
  • _addWord(index,word) Add the word at the index to the dictionary
  • _cancel() Cancel this check action
  • _connectUp() Connect up all the events with their event handlers
  • _disabled(name,disabled) When the plugin is disabled (the button is disabled), reset all to their initial status.
  • _enter() Handle the ENTER event
  • _findText(txt,caseSensitive,backwards) This function invokes a find with specific options
  • _getAttrNames(name) Helper function for get() and set().
  • _getBookmark(eValue) Get the cursor position.
  • _html2Text(html) Substitute the tag with white charactors so that the server can easily process the text.
  • _initButton() Initialize the button displayed on the editor's toolbar
  • _keyPress(evt) The handler of the onKeyPress event of the editor
  • _loadData(data) Apply the query result to the content
  • _markIncorrectWords(html,cache) Mark the incorrect words and set up menus if available
  • _moveToBookmark() Move to the position when the cursor was.
  • _openDialog() The handler of the onOpen event
  • _populateDialog(index) Populate the content of the dailog
  • _query(html) Send the query text to the service.
  • _replace() Replace the incorrect word with the selected one, or the one the user types in the textbox
  • _replaceAll() Replace all the words with the same text
  • _replaceWord(index,text) Replace the word at the given index with the text
  • _selectWord(index) Select the incorrect word.
  • _set(name,value) Helper function to set new value for specified attribute
  • _setDisabledAttr(disabled) Function to set the plugin state and call updateState to make sure the button is updated appropriately.
  • _setNetwork() Set up the underlying network service
  • _skip(evt,noUpdate) Ignore this word and move to the next unignored one.
  • _skipAll() Ignore all the same words
  • _skipWord(index) Skip the word at the index
  • _skipWordAll(index,word) Skip the all the word that have the same text as the word at the index or the given word
  • _SpellCheckControl()
  • _spellCheckFilter(value) Filter out the incorrect word style so that the value of the edtior won't include the spans that wrap around the incorrect words
  • _SpellCheckScriptMultiPart()
  • _submitContent(delay) Functions to submit the content of the editor
  • buttonClass() Class of widget (ex: dijit.form.Button or dijit/form/FilteringSelect) that is added to the toolbar to control this plugin.
  • connect(o,f,tf) Deprecated.
  • destroy()
  • get(name) Get a property from a plugin.
  • getLabel(key) Returns the label to use for the button
  • own() Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.
  • set(name,value) Set a property on a plugin
  • setEditor(editor)
  • setToolbar(toolbar) Tell the plugin to add it's controller widget (often a button) to the toolbar.
  • updateState() Change state of the plugin to respond to events in the editor.

Properties

_cursorSelector

The CSS selector of the cursor span

_cursorSpan

The span that holds the current position of the cursor

_editor

The reference to the editor the plug-in belongs to.

_highlightedIncorrectStyle

The style of the highlighted incorrect words

_ignoredIncorrectStyle

The style of the ignored incorrect words

_incorrectWordsSpan

The wrapper that marks the incorrect words

_maxItemNumber

The max number of the suggestion list items

_normalIncorrectStyle

The style of the marked incorrect words.

_selector

An empty CSS class that identifies the incorrect words

bufferLength

The max length of each XHR request. It is used to divide the large text into pieces so that the server-side piece can hold.

button

The button displayed on the editor's toolbar

command
Defined by: dijit/_editor/_Plugin

String like "insertUnorderedList", "outdent", "justifyCenter", etc. that represents an editor command. Passed to editor.execCommand() if useDefaultCommand is true.

disabled
Defined by: dijit/_editor/_Plugin

Flag to indicate if this plugin has been disabled and should do nothing helps control button state, among other things. Set via the setter api.

editor
Defined by: dijit/_editor/_Plugin

Points to the parent editor

exArgs

The object that holds all the parametes passed into the constructor

iconClassPrefix
Defined by: dijit/_editor/_Plugin

The CSS class name for the button node is formed from iconClassPrefix and command

interactive

Indicate if the interactive spelling check is enabled

timeout

The minutes to waiting for the response. The default value is 30 seconds.

url

The url of the spelling check service

useDefaultCommand
Defined by: dijit/_editor/_Plugin

If true, this plugin executes by calling Editor.execCommand() with the argument specified in command.

Methods

_add()

Add the unrecognized word into the dictionary

_addWord(index,word)

Add the word at the index to the dictionary

Parameter Type Description
index undefined

The index of the span list

word String
Optional

If this argument is given, add the word to the dictionary and skip all the words like it

_cancel()

Cancel this check action

_connectUp()

Connect up all the events with their event handlers

_disabled(name,disabled)

When the plugin is disabled (the button is disabled), reset all to their initial status. If the interactive mode is on, check the content once it is enabled.

Parameter Type Description
name undefined

Command name

disabled undefined

Command argument

_enter()

Handle the ENTER event

_findText(txt,caseSensitive,backwards)

This function invokes a find with specific options

Parameter Type Description
txt String

The text to locate in the document.

caseSensitive Boolean

Whether or ot to search case-sensitively.

backwards Boolean

Whether or not to search backwards in the document.

Returns:any | undefined

Boolean indicating if the content was found or not.

_getAttrNames(name)

Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

Parameter Type Description
name undefined
Returns:undefined | object
_getBookmark(eValue)

Get the cursor position. It is the index of the characters where the cursor is.

Parameter Type Description
eValue String

The html value of the editor

Returns:number
_html2Text(html)

Substitute the tag with white charactors so that the server can easily process the text. For example:

"<a src="sample.html">Hello, world!</a>" ==>
"                     Hello, world!    "
Parameter Type Description
html undefined

The html code

Returns:undefined
_initButton()

Initialize the button displayed on the editor's toolbar

_keyPress(evt)

The handler of the onKeyPress event of the editor

Parameter Type Description
evt undefined
_loadData(data)

Apply the query result to the content

Parameter Type Description
data Array

The result of the query

_markIncorrectWords(html,cache)

Mark the incorrect words and set up menus if available

Parameter Type Description
html String

The html value of the editor

cache Object

The local word cache

_moveToBookmark()

Move to the position when the cursor was.

_openDialog()

The handler of the onOpen event

_populateDialog(index)

Populate the content of the dailog

Parameter Type Description
index undefined

The idex of the span list

_query(html)

Send the query text to the service. The query text is a string of words separated by space.

Parameter Type Description
html String

The html value of the editor

_replace()

Replace the incorrect word with the selected one, or the one the user types in the textbox

_replaceAll()

Replace all the words with the same text

_replaceWord(index,text)

Replace the word at the given index with the text

Parameter Type Description
index undefined

The index of the span list

text undefined

The text to be replaced with

_selectWord(index)

Select the incorrect word. Move to it and highlight it

Parameter Type Description
index undefined

The index of the span list

_set(name,value)

Helper function to set new value for specified attribute

Parameter Type Description
name String
value anything
_setDisabledAttr(disabled)

Function to set the plugin state and call updateState to make sure the button is updated appropriately.

Parameter Type Description
disabled undefined
_setNetwork()

Set up the underlying network service

_skip(evt,noUpdate)

Ignore this word and move to the next unignored one.

Parameter Type Description
evt Event
Optional

The event object

noUpdate Boolean
Optional

Indicate whether to update the status of the span list or not

_skipAll()

Ignore all the same words

_skipWord(index)

Skip the word at the index

Parameter Type Description
index undefined

The index of the span list

_skipWordAll(index,word)

Skip the all the word that have the same text as the word at the index or the given word

Parameter Type Description
index undefined

The index of the span list

word String
Optional

If this argument is given, skip all the words that have the same text as the word

_SpellCheckControl()
_spellCheckFilter(value)

Filter out the incorrect word style so that the value of the edtior won't include the spans that wrap around the incorrect words

Parameter Type Description
value String

The html value of the editor

Returns:undefined
_SpellCheckScriptMultiPart()
_submitContent(delay)

Functions to submit the content of the editor

Parameter Type Description
delay Boolean
Optional

Indicate if the action is taken immediately or not

buttonClass()

Class of widget (ex: dijit.form.Button or dijit/form/FilteringSelect) that is added to the toolbar to control this plugin. This is used to instantiate the button, unless button itself is specified directly.

connect(o,f,tf)

Deprecated. Use this.own() with dojo/on or dojo/aspect.instead.

Make a connect.connect() that is automatically disconnected when this plugin is destroyed. Similar to dijit/_Widget.connect().

Parameter Type Description
o undefined
f undefined
tf undefined
destroy()
get(name)

Get a property from a plugin.

Get a named property from a plugin. The property may potentially be retrieved via a getter method. If no getter is defined, this just retrieves the object's property. For example, if the plugin has a properties "foo" and "bar" and a method named "_getFooAttr", calling:

plugin.get("foo");

would be equivalent to writing:

plugin._getFooAttr();

and:

plugin.get("bar");

would be equivalent to writing:

plugin.bar;
Parameter Type Description
name undefined

The property to get.

Returns:undefined
getLabel(key)

Returns the label to use for the button

Parameter Type Description
key String
Returns:undefined
own()
Defined by dijit/Destroyable

Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

Returns:any | undefined

The array of specified handles, so you can do for example:

var handle = this.own(on(...))[0];
set(name,value)

Set a property on a plugin

Sets named properties on a plugin which may potentially be handled by a setter in the plugin. For example, if the plugin has a properties "foo" and "bar" and a method named "_setFooAttr", calling:

plugin.set("foo", "Howdy!");

would be equivalent to writing:

plugin._setFooAttr("Howdy!");

and:

plugin.set("bar", 3);

would be equivalent to writing:

plugin.bar = 3;

set() may also be called with a hash of name/value pairs, ex:

plugin.set({
    foo: "Howdy",
    bar: 3
})

This is equivalent to calling set(foo, "Howdy") and set(bar, 3)

Parameter Type Description
name attribute

The property to set.

value anything

The value to set in the property.

Returns:function | string

Set a property on a plugin

setEditor(editor)
Parameter Type Description
editor dijit.Editor
setToolbar(toolbar)

Tell the plugin to add it's controller widget (often a button) to the toolbar. Does nothing if there is no controller widget.

Parameter Type Description
toolbar dijit/Toolbar
updateState()

Change state of the plugin to respond to events in the editor.

This is called on meaningful events in the editor, such as change of selection or caret position (but not simple typing of alphanumeric keys). It gives the plugin a chance to update the CSS of its button.

For example, the "bold" plugin will highlight/unhighlight the bold button depending on whether the characters next to the caret are bold or not.

Only makes sense when useDefaultCommand is true, as it calls Editor.queryCommandEnabled(command).

Error in the documentation? Can’t find what you are looking for? Let us know!