Grammalecte  Check-in [6cd37e7067]

Overview
Comment:[doc] Web API update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | doc
Files: files | file ages | folders
SHA3-256: 6cd37e706729805932a6fda917afb18f99b7f0b1346fa10859024589264294a4
User & Date: olr on 2020-03-19 08:10:29
Other Links: manifest | tags
Context
2020-03-19
08:19
[doc] Web API update check-in: 6727222f1a user: olr tags: doc, trunk
08:10
[doc] Web API update check-in: 6cd37e7067 user: olr tags: doc, trunk
08:06
[doc] Web API update check-in: 960b24f7ac user: olr tags: doc, trunk
Changes

Modified doc/API_web.md from [40448ef602] to [a4bf78ddb6].

1
2
3
4
5
6
7
8
9
10
11
12
..
16
17
18
19
20
21
22





23
24
25
26
27
28
29
...
118
119
120
121
122
123
124
125
126
127
128
129
# API for the web

## Using the Grammalecte API for the web

**With Grammalecte 1.8+.**

If Grammalecte is installed by the user on his browser (like Firefox or Chrome), you can call
several functions for a better integration of grammar checking for your website. This is mostly usefull
if you use non-standard textareas.

You can:

................................................................................

- get the modified text via events (instead of having the node content directly modified),

- get raw results (list of errors) of grammar checking and spell checking,

- get spelling suggestions for a wrong word.







### How it works

Usually, webpage scripts can’t call methods or functions of browser extensions.

The Grammalecte API is injected within your webpage, with methods launching events that Grammalecte is listening. When Grammalecte receives one of these events, it launches the requested tasks. Results may be sent via events on webpage nodes.

................................................................................
    node.addEventListener("GrammalecteResult", function (event) {
        if (event.detail.sType  &&  event.detail.sType == "spellsugg") {
            let oResult = event.detail.oResult;
            let oInfo = event.detail.oInfo; // object containing the destination and the error_identifier
            ...
        }
    }


### Version of the Grammalecte Web API

    oGrammalecteAPI.sVersion




|







 







>
>
>
>
>







 







<
<
<
<
<
1
2
3
4
5
6
7
8
9
10
11
12
..
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
...
123
124
125
126
127
128
129





# API for the web

## Using the Grammalecte API for the web

**With Grammalecte 1.8+.** (beta stage)

If Grammalecte is installed by the user on his browser (like Firefox or Chrome), you can call
several functions for a better integration of grammar checking for your website. This is mostly usefull
if you use non-standard textareas.

You can:

................................................................................

- get the modified text via events (instead of having the node content directly modified),

- get raw results (list of errors) of grammar checking and spell checking,

- get spelling suggestions for a wrong word.


### Version of the Grammalecte Web API

    oGrammalecteAPI.sVersion


### How it works

Usually, webpage scripts can’t call methods or functions of browser extensions.

The Grammalecte API is injected within your webpage, with methods launching events that Grammalecte is listening. When Grammalecte receives one of these events, it launches the requested tasks. Results may be sent via events on webpage nodes.

................................................................................
    node.addEventListener("GrammalecteResult", function (event) {
        if (event.detail.sType  &&  event.detail.sType == "spellsugg") {
            let oResult = event.detail.oResult;
            let oInfo = event.detail.oInfo; // object containing the destination and the error_identifier
            ...
        }
    }