Skip to content
This repository has been archived by the owner. It is now read-only.

Latest commit

 

History

History
2332 lines (1801 loc) · 65.1 KB

File metadata and controls

2332 lines (1801 loc) · 65.1 KB
layout post
title API reference for ejSpellCheck
description What are the options, methods and events available in Essential JavaScript ejSpellCheck.
documentation API
platform angular-api
keywords ejSpellCheck, API, Essential JS ejSpellCheck, SpellCheck

ejSpellCheck

The spell check control will be using to check/correct the spelling of words from a given content.

Syntax

{% highlight javascript %}

$(element).ejSpellCheck()

{% endhighlight %}

Example

{% highlight html %}

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

constructor() { }

}

{% endhighlight %}

Requires

  • module:jQuery
  • module:ej.core.js
  • module:ej.data.js
  • module:ej.globalize.js
  • module:ej.scroller.js
  • module:ej.draggable.js
  • module:ej.dialog.js
  • module:ej.button.js
  • module:ej.listbox.js
  • module:ej.menu.js
  • module:ej.spellcheck.js

Members

dictionarySettings object

{:#members:dictionarysettings}

It includes the service method path to find the error words and its suggestions also adding the custom word into the custom dictionary.

Example – DictionarySettings field mapped with string type values

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

dictionarySettings.dictionaryUrl string

{:#members:dictionarysettings-dictionaryurl}

The dictionaryUrl option accepts string, which is the method path to find the error words and get the suggestions to correct the errors.

Default Value

  • ""

Example – To set the dictionaryUrl of SpellCheck control

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings.dictionaryUrl]="DictionaryUrl">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionaryUrl: any;
constructor() {
    this.DictionaryUrl = "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords";
}

}

{% endhighlight %}

dictionarySettings.customDictionaryUrl string

{:#members:dictionarysettings-customdictionaryurl}

The customDictionaryUrl option accepts string, which is the method path to add the error word into the custom dictionary.

Default Value

  • ""

Example – To set the customDictionaryUrl of SpellCheck control

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

misspellWordCss string

{:#members:misspellwordcss}

To display the error word in a customized style.

Default Value

  • "e-errorword"

Example - To display the error word in green color

{% highlight html %}

<ej-spellcheck id="SpellCheck" misspellWordCss="highlight" [dictionarySettings]="DictionarySettings">

<style type="text/css"> .highlight { color: green; } </style>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

locale string

{:#members:locale}

Sets the specific culture to the SpellCheck.

Default Value

  • "en-US"

Example - To set the French culture on SpellCheck, set its locale as fr-FR.

{% highlight html %}

<ej-spellcheck id="SpellCheck" locale="fr-FR" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

To set any culture for SpellCheck, refer to the required minified globalize files of the specific culture. For example, to use fr-FR culture in SpellCheck, refer to the globalize.culture.fr-FR.min.js script file. Also define the locale words of that specific culture properly. For example, define the locale words for fr-FR culture in a variable ej.SpellCheck.Locale[“fr-FR”] = { }; under script section.

maxSuggestionCount number

{:#members:maxsuggestioncount}

To set the maximum suggestion display count.

Default Value

  • 6

Example - To set the maxSuggestionCount value as 4

{% highlight html %}

<ej-spellcheck id="SpellCheck" [maxSuggestionCount]="SuggestionCount" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public SuggestionCount: number;
public DictionarySettings: any;
constructor() {
    this.SuggestionCount = 4;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

ignoreWords array

{:#members:ignorewords}

To ignore the words from the error word consideration.

Default Value

  • []

Example - To set the ignoreWords

{% highlight html %}

<ej-spellcheck id="SpellCheck" [ignoreWords]="IgnoreWords" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public IgnoreWords: number;
public DictionarySettings: any;
constructor() {
    this.IgnoreWords = ["Syncfusion", "JavaScript"];
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

contextMenuSettings object

{:#members:contextmenusettings}

Holds all options related to the context menu settings of SpellCheck.

contextMenuSettings.enable boolean

{:#members:contextmenusettings-enable}

When set to true, enables the context menu options available for the SpellCheck.

Default Value

  • true

Example - To disable the context menu options for SpellCheck control

{% highlight html %}

<ej-spellcheck id="SpellCheck" [contextMenuSettings.enable]="ContextMenuEnable" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public ContextMenuEnable: boolean;
public DictionarySettings: any;
constructor() {
    this.ContextMenuEnable = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

contextMenuSettings.menuItems array

{:#members:contextmenusettings-menuitems}

Contains all the default context menu options that are applicable for SpellCheck. It also supports adding custom menu items. All the SpellCheck related context menu items are grouped under this menu collection.

Default Value

  • {% highlight javascript %}

    [ { id: "IgnoreAll", text: "Ignore All" }, { id: "AddToDictionary", text: "Add To Dictionary" } ]

    {% endhighlight %}

Example - To add custom context menu option to the SpellCheck

{% highlight html %}

<ej-spellcheck id="SpellCheck" [contextMenuSettings]="ContextMenuSettings" [dictionarySettings]="DictionarySettings" (contextClick)="onCustomMenuClick($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public ContextMenuSettings: any;
public DictionarySettings: any;
constructor() {
    this.ContextMenuSettings = {
        enable: true,
        menuItems: [
            { id: "Ignore", text: "IgnoreOnce" },
            { id: "IgnoreAll", text: "Ignore All" },
            { id: "AddToDictionary", text: "Add To Dictionary" }
        ]
    };
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onCustomMenuClick(args) {
    if (args.events.ID == "Ignore") {
        var spellObj = $("#TextArea").data("ejSpellCheck");
        var ignoreResult = spellObj.ignore(args.selectedValue, args.targetContent, 0);
    }
}

}

{% endhighlight %}

ignoreSettings object

{:#members:ignoresettings}

It helps to ignore the uppercase, mixed case words, alpha numeric words, file path and email addresses based on the property values.

ignoreSettings.ignoreAlphaNumericWords string

{:#members:ignoresettings-ignorealphanumericwords}

When set to true, ignoring the alphanumeric words from the error word consideration.

Default Value

  • true

Example – To consider the alphanumeric words as an error word

{% highlight html %}

<ej-spellcheck id="SpellCheck" [ignoreSettings.ignoreAlphaNumericWords]="AlphaNumericWords" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public AlphaNumericWords: boolean;
public DictionarySettings: any;
constructor() {
    this.AlphaNumericWords = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

ignoreSettings.ignoreEmailAddress boolean

{:#members:ignoresettings-ignoreemailaddress}

When set to true, ignoring the Email address from the error word consideration.

Default Value

  • true

Example – To consider the Email Address as an error word

{% highlight html %}

<ej-spellcheck id="SpellCheck" [ignoreSettings.ignoreEmailAddress]="IgnoreEmailAddress" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public IgnoreEmailAddress: boolean;
public DictionarySettings: any;
constructor() {
    this.IgnoreEmailAddress = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

ignoreSettings.ignoreMixedCaseWords boolean

{:#members:ignoresettings-ignoremixedcasewords}

When set to true, ignoring the MixedCase words from the error word consideration.

Default Value

  • true

Example – To consider the MixedCase words as an error word

{% highlight html %}

<ej-spellcheck id="SpellCheck" [ignoreSettings.ignoreMixedCaseWords]="MixedCaseWords" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public MixedCaseWords: boolean;
public DictionarySettings: any;
constructor() {
    this.MixedCaseWords = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

ignoreSettings.ignoreUpperCase boolean

{:#members:ignoresettings-ignoreuppercase}

When set to true, ignoring the UpperCase words from the error word consideration.

Default Value

  • true

Example – To consider the UpperCase words as an error word

{% highlight html %}

<ej-spellcheck id="SpellCheck" [ignoreSettings.ignoreUpperCase]="IgnoreUpperCase" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public IgnoreUpperCase: boolean;
public DictionarySettings: any;
constructor() {
    this.IgnoreUpperCase = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

ignoreSettings.ignoreUrl boolean

{:#members:ignoresettings-ignoreurl}

When set to true, ignoring the Url from the error word consideration.

Default Value

  • true

Example – To consider the Url as an error word

{% highlight html %}

<ej-spellcheck id="SpellCheck" [ignoreSettings.ignoreUrl]="IgnoreUrl" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public IgnoreUrl: boolean;
public DictionarySettings: any;
constructor() {
    this.IgnoreUrl = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

ignoreSettings.ignoreFileNames boolean

{:#members:ignoresettings-ignorefilenames}

When set to true, ignoring the file address path from the error word consideration.

Default Value

  • true

Example – To consider the file names as an error word

{% highlight html %}

<ej-spellcheck id="SpellCheck" [ignoreSettings.ignoreFileNames]="IgnoreFileNames" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public IgnoreFileNames: boolean;
public DictionarySettings: any;
constructor() {
    this.IgnoreFileNames = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

isResponsive boolean

{:#members:isresponsive}

When set to true, allows the spellcheck to render based upon screen size.

Default Value

  • true

Example – To render the spellcheck dialog with the default size

{% highlight html %}

<ej-spellcheck id="SpellCheck" [isResponsive]="Responsive" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public Responsive: boolean;
public DictionarySettings: any;
constructor() {
    this.Responsive = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

enableValidateOnType boolean

{:#members:enablevalidateontype}

Gets or sets a value that indicates whether to enable the spellcheck operation on Enter/Space key-press.

Default Value

  • false

Example - To validate for spellcheck the content on press the Enter & Space key.

{% highlight html %}

<ej-spellcheck id="SpellCheck" [enableValidateOnType]="EnableValidateOnType" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public EnableValidateOnType: boolean;
public DictionarySettings: any;
constructor() {
    this.EnableValidateOnType = true;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

controlsToValidate string

{:#members:controlstovalidate}

It allows to spell check the multiple target HTML element's texts and correct its error words.

Default Value

  • null

Example – To check the spelling of the three target HTML element's (ex: div, textarea, span)

{% highlight html %}

London, one of the most popular tourist destinations in the world for a reason. A cultural and historical hub, London has an excellent public transportation system that allows visitors to see all the fantastic sights without spending a ton of money on a rental car. London contains four World Heritage Sites.

<textarea id="control2" style="width:940px"> Paris, the city of lights and love - this short guide is full of ideas for how to make the most of the romanticism that oozes from every one of its beautiful corners.You couldn't possibly visit Paris without seeing the Eiffel Tower. Even if you do not want to visit this world famous structure, you will see its top from all over Paris. </textarea>
Rome, one of the world's most fascinating cities. The old adage that Rome was not built in a day - and that you won't see it in one or even in three - is true. For the intrepid traveler who can keep pace, here is a list of must-sees. But remember what the Romans say: Even a lifetime isn't enough to see Rome.

<ej-spellcheck id="SpellCheck" controlsToValidate="control1,control2,control3" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

You need to pass the target HTML element's id value to this property with the comma separator. For example, in the above code example passed id values of div(control1), textarea(control2) and span(control3) element.

enableAsync boolean

{:#members:enableasync}

When set to true, allows sending Asynchronous ajax request for checking the spelling errors.

Default Value

  • true

Example – To check the spelling of the target element by sending Synchronous request

{% highlight html %}

<ej-spellcheck id="SpellCheck" [enableAsync]="EnableAsync" [dictionarySettings]="DictionarySettings">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public EnableAsync: boolean;
public DictionarySettings: any;
constructor() {
    this.EnableAsync = false;
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

Methods

showInDialog()

{:#methods:showindialog}

Open the dialog to correct the spelling of the target content.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.showInDialog(); // Open the dialog mode </script>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

validate()

{:#methods:validate}

Highlighting the error word in the target area itself and correct the spelling using the context menu.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.validate(); // highlighting the error word in the target area itself </script>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

spellCheck(targetSentence, misspellWordCss)

{:#methods:spellcheck}

To get the error word highlighted string by passing the given input sentence.

Name Type Description
targetSentence string Content to be spell check
misspellWordCss string Class name that contains style value to highlight the error word

Returns

object

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var targetSentence = "This example sentence contains error words". var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.spellCheck(targetSentence,"highlight"); </script> <style type="text/css"> .highlight { color: green; } </style>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

ignoreAll(word, targetSentence)

{:#methods:ignoreall}

To ignore all the error word occurrences from the given input sentence.

Name Type Description
word string Error word to ignore from the target content
targetSentence string Content to perform the ignore all operation

Returns

object

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var targetSentence = "The first textarea sample uses a dialog textarea to display the sample spell textarea errors". var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.ignoreAll("textarea",targetSentence); </script>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

ignore(word, targetSentence, index)

{:#methods:ignore}

To ignore the error word once from the given input sentence.

Name Type Description
word string Error word to ignore from the target content
targetSentence string Content to perform the ignore operation
index number Index of the error word present in the target content

Returns

object

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var targetSentence = "The first textarea sample uses a dialog textarea to display the sample spell textarea errors". var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.ignore("textarea",targetSentence, null); </script>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

change(word, targetSentence, changeWord, index)

{:#methods:change}

To change the error word once from the given input sentence.

Name Type Description
word string Error word to change from the target content
targetSentence string Content to perform the change operation
changeWord string Word to replace with the error word
index number Index of the error word present in the target content

Returns

object

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var targetSentence = "The first textarea sample uses a dialog textarea to display the sample spell textarea errors". var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.change("textarea",targetSentence,"text area", null); </script>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

The 'index' is the error word occurrence in the given input string. For example, if you pass the index value as 1 means and the error word as textarea it will ignore the second occurrence (which is present after the word dialog) in the given string.

changeAll(word, targetSentence, changeWord)

{:#methods:changeall}

To change all the error word occurrences from the given input sentence.

Name Type Description
word string Error word to change from the target content
targetSentence string Content to perform the change all operation
changeWord string Word to replace with the error word

Returns

object

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var targetSentence = "The first textarea sample uses a dialog textarea to display the sample spell textarea errors". var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.changeAll("textarea",targetSentence,"text area"); </script>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

addToDictionary(word)

{:#methods:addtodictionary}

To add the words into the custom dictionary.

Name Type Description
customWord string Word to add into the dictionary file

Returns

object

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.addToDictionary("textarea"); </script>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

getSuggestionWords(errorWord)

{:#methods:getsuggestionwords}

Retrieves the possible suggestion words for the error word passed as an argument.

Name Type Description
errorWord string Error word to get the suggestions

Returns

object

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings">

<script type="text/javascript"> var schObj = $("#SpellCheck").data("ejSpellCheck"); schObj.getSuggestionWords("textarea"); </script>

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

}

{% endhighlight %}

Events

actionSuccess

{:#events:actionsuccess}

Triggers on the success of AJAX call request.

Name Type Description
resultHTML string Returns the error word highlighted string.
errorWordDetails object Returns the error word details of the given input.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (actionSuccess)="onActionSuccess($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onActionSuccess(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

actionBegin

{:#events:actionbegin}

Triggers on the AJAX call request beginning.

Name Type Description
targetSentence string Returns the input string.
misspellWordCss string Returns the misspellWordCss class name.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (actionBegin)="onActionBegin($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onActionBegin(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

actionFailure

{:#events:actionfailure}

Triggers when the AJAX call request failure.

Name Type Description
errorMessage string Returns AJAX request failure error message.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (actionFailure)="onActionFailure($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onActionFailure(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

start

{:#events:start}

Triggers when the dialog mode spell check starting.

Name Type Description
targetSentence string Returns the input string.
errorWords object Returns the error words details.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (start)="onStart($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onStart(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

complete

{:#events:complete}

Triggers when the spell check operations completed through dialog mode.

Name Type Description
resultHTML string Returns the error word highlighted string.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (complete)="onComplete($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onComplete(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

contextOpen

{:#events:contextopen}

Triggers before context menu opening.

Name Type Description
selectedErrorWord string Returns the selected error word.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (contextOpen)="onContextOpen($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onContextOpen(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

contextClick

{:#events:contextclick}

Triggers when the context menu item clicked.

Name Type Description
selectedValue string Returns the selected error word.
selectedOption string Returns the selected option in the context menu.
targetContent string Returns the input string.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (contextClick)="onContextClick($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onContextClick(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

dialogBeforeOpen

{:#events:dialogbeforeopen}

Triggers before the spell check dialog opens.

Name Type Description
spellCheckDialog object Returns the spell check window details.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (dialogBeforeOpen)="onDialogBeforeOpen($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onDialogBeforeOpen(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

dialogOpen

{:#events:dialogopen}

Triggers after the spell check dialog opens.

Name Type Description
targetText string Returns the target input.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (dialogOpen)="onDialogOpen($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onDialogOpen(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

dialogClose

{:#events:dialogclose}

Triggers when the spell check dialog closed.

Name Type Description
updatedText string Returns the error corrected string.
requestType string Returns the request type value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (dialogClose)="onDialogClose($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onDialogClose(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

validating

{:#events:validating}

Triggers when the spell check control performing the spell check operations such as ignore, ignoreAll, change, changeAll and addToDictionary.

Name Type Description
argument object Event parameters when ignore the error word once:
Name Type Description
cancel boolean Returns the cancel option value.
ignoreWord string Returns the error word to ignore.
targetContent string Returns the target content.
index number Returns the index of an error word.
model object Returns the SpellCheck model.
requestType string Returns the validating request type.
type string Returns the name of the event.
argument object Event parameters when ignore all the occurrences of an error word:
Name Type Description
cancel boolean Returns the cancel option value.
ignoreWord string Returns the error word to ignore.
targetContent string Returns the target content.
model object Returns the SpellCheck model.
requestType string Returns the validating request type.
type string Returns the name of the event.
argument object Event parameters when changing the error word occurrence once:
Name Type Description
cancel boolean Returns the cancel option value.
changeableWord string Returns the error word to change.
targetContent string Returns the target content.
changeWord string Returns the change word to replace the error word.
index number Returns the index of an error word.
model object Returns the SpellCheck model.
requestType string Returns the validating request type.
type string Returns the name of the event.
argument object Event parameters when changing all the occurrences of an error word:
Name Type Description
cancel boolean Returns the cancel option value.
changeableWord string Returns the error word to change.
targetContent string Returns the target content.
changeWord string Returns the change word to replace the error word.
model object Returns the SpellCheck model.
requestType string Returns the validating request type.
type string Returns the name of the event.
argument object Event parameters when adding the error word into the dictionary file:
Name Type Description
cancel boolean Returns the cancel option value.
customWord string Returns the custom word to add into dictionary file.
model object Returns the SpellCheck model.
requestType string Returns the validating request type.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (validating)="onValidating($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onValidating(args) {
    /* Do further actions here */
}

}

{% endhighlight %}

targetUpdating

{:#events:targetupdating}

Triggers before loading the target HTML element text into the dialog sentence area.

Name Type Description
previousElement Object Returns the previous target element value.
currentElement Object Returns the current target element value.
targetHtml string Returns the target html value.
cancel boolean Returns the cancel option value.
model object Returns the SpellCheck model.
type string Returns the name of the event.

Example

{% highlight html %}

<ej-spellcheck id="SpellCheck" [dictionarySettings]="DictionarySettings" (targetUpdating)="onTargetUpdating($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent {

public DictionarySettings: any;
constructor() {
    this.DictionarySettings = {
        dictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/CheckWords",
        customDictionaryUrl: "http://js.syncfusion.com/demos/ejservices/api/SpellCheck/AddToDictionary"
    };
}

onTargetUpdating(args) {
    /* Do further actions here */
}

}

{% endhighlight %}