Page History
Excerpt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1. Initialization OptionsThere are several options letting you initialize WProofreader functionality in your web app, namely using:
After you have initialized WProofreader, you can customize the above-mentioned settings using WebSpellChecker API.
Below you can find the samples showing how different approaches work. Example 1: Initializing WProofreader using autoSearch
Scenario A: Initializing WProofreader with autoSearch functionality and defining configuration options in CONFIG
Scneario B: Initializing WProofreader with autoSearch functionality and defining configuration options using inline data attributes
Example 2: Initializing WProofreader using autoSearch and init() methodWhen you initialize WProofreader using this method, in init () method we declare the container where WProofreader should be started. The options are to be obtained from the settings.
Initializing WProofreader using init() method in a defined container on the page and specifying configuration options directly in the init() function:
Example 3: Initialization using init() method in a defined container
Initializing WProofreader using init() method in a defined container(s) on the page and specifying configuration options in CONFIG is shown in the sample below. You can see two containers, namely, div and textarea which use a single configuration script:
Example 4: Initializing WProofreader by redefining options priorityInitializing WProofreader in HTML controls using data-wsc-autocreate="true" and specifying configuration options in CONFIG. This approach is similar to initializing WProofreader using init() method.
Initializing WProofreader using init() method using autoSearch and autoDestroy in WYSIWYG editors such as Froala Editor 3, CKEditor 4 and CKEditor 5 and specifying the options in CONFIG.
Froala Editor code sample:
Example 5: Using init() method with autoSearch and autoDestroy in WYSIWYG editorsWhen initializing WProofreader using init() method with autoSearch and autoDestroy in WYSIWYG editors such as Froala Editor 3, CKEditor 4, and CKEditor 5 and specifying the options in CONFIG, the autoDestroy parameter turns on/off the auto-destroy functionality of a WebSpellChecker instance. By default, it is enabled for WProofreader initialized using autoSearch. It can be used to avoid monitoring the state of the instance and handling its destroying after removal of an editable container from the page. It can be useful for example, when we have created our instance, and later we don’t need to worry to remove it in certain cases. Deleting an instance from the page takes place when an edited element is deleted or hidden. When switching to the code editing mode in the editor we need to delete our instance and then to restore it after returning back to the editor. Thus, it is the autoSearch that restores it.
Froala Editor example:
|