Grammalecte  Check-in [dd946dd5bb]

Overview
Comment:[fx] API: new name for type of result: errors -> proofreading
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: dd946dd5bb10b574c20f302899bd2c21bb5e739a1fed39bd4042155688d0b574
User & Date: olr on 2020-03-18 18:39:31
Other Links: manifest | tags
Context
2020-03-18
21:15
[fr] ajustements check-in: b4e115ba18 user: olr tags: trunk, fr
18:39
[fx] API: new name for type of result: errors -> proofreading check-in: dd946dd5bb user: olr tags: trunk, fx
17:36
[fx] update observePage() check-in: 99326d3d4b user: olr tags: trunk, fx
Changes

Modified doc/API_web.md from [cc9ca133c0] to [1cf8573643].

65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79







-
+







    oGrammalecteAPI.parseNode("node_id")
    oGrammalecteAPI.parseNode(node)

The node can be a textarea, an editable node or an iframe. The node must have an identifier.
Results will be sent with a succession of events at the node.

    node.addEventListener("GrammalecteResult", function (event) {
        if (event.detail.sType  &&  event.detail.sType == "errors") {
        if (event.detail.sType  &&  event.detail.sType == "proofreading") {
            let oResult = event.detail.oResult; // null when the text parsing is finished
            ...
        }
    }

For the last event, `oResult` will be `null`.

Modified gc_lang/fr/webext/content_scripts/init.js from [c339804e39] to [033ce72bd9].

405
406
407
408
409
410
411
412

413
414
415
416
417
418
419
405
406
407
408
409
410
411

412
413
414
415
416
417
418
419







-
+







                            oGrammalecte.oGCPanel.addParagraphResult(result);
                        } else {
                            oGrammalecte.oGCPanel.stopWaitIcon();
                            oGrammalecte.oGCPanel.endTimer();
                        }
                    }
                    else if (oInfo.sDestination  &&  document.getElementById(oInfo.sDestination)) {
                        const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "errors", oResult: result, oInfo: oInfo }) });
                        const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "proofreading", oResult: result, oInfo: oInfo }) });
                        document.getElementById(oInfo.sDestination).dispatchEvent(xEvent);
                    }
                    break;
                case "parseAndSpellcheck1":
                    if (oInfo.sDestination == "__GrammalectePanel__") {
                        oGrammalecte.oGCPanel.refreshParagraph(oInfo.sParagraphId, result);
                    }