Overview
Comment: | [fx] Grammalecte API: parseNode -> result as JSON |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx |
Files: | files | file ages | folders |
SHA3-256: |
15fc2e7c11b8b4e905aa65d857afe7a0 |
User & Date: | olr on 2020-03-13 19:37:37 |
Other Links: | manifest | tags |
Context
2020-03-13
| ||
20:04 | [fx] Grammalecte API: getSpellSuggestions() check-in: 9a083a0fd5 user: olr tags: trunk, fx | |
19:37 | [fx] Grammalecte API: parseNode -> result as JSON check-in: 15fc2e7c11 user: olr tags: trunk, fx | |
17:08 | [fx] code clarification: use one object dedicated to communication between content-script and background check-in: be4cac56bf user: olr tags: trunk, fx | |
Changes
Modified gc_lang/fr/webext/content_scripts/api.js from [d7c42966b4] to [28772a3aac].
︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 58 59 | - - - - - - - - - | parseNode: function (xNode) { if (xNode instanceof HTMLElement) { let xEvent = new CustomEvent("GrammalecteCall", { detail: {sCommand: "parseNode", xNode: xNode} }); document.dispatchEvent(xEvent); } else { console.log("[Grammalecte API] Error: parameter is not a HTML node."); } |
Modified gc_lang/fr/webext/content_scripts/init.js from [6fdc529374] to [166fd912ce].
︙ | |||
386 387 388 389 390 391 392 393 394 395 396 397 398 399 | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | + + + + | if (!bEnd) { oGrammalecte.oGCPanel.addParagraphResult(result); } else { oGrammalecte.oGCPanel.stopWaitIcon(); oGrammalecte.oGCPanel.endTimer(); } } else if (dInfo.sDestination && document.getElementById(dInfo.sDestination)) { const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify(result) }); document.getElementById(dInfo.sDestination).dispatchEvent(xEvent); } break; case "parseAndSpellcheck1": if (dInfo.sDestination == "__GrammalectePanel__") { oGrammalecte.oGCPanel.refreshParagraph(dInfo.sParagraphId, result); } break; case "parseFull": |
︙ | |||
510 511 512 513 514 515 516 | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | - - - + + + + + + + + - + + + + + + + + + + | break; case "openPanelForText": if (oCommand.sText) { oGrammalecte.startGCPanel(oCommand.sText); } break; case "parseNode": |
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [1cfb37cbb6] to [2e408919b2].
︙ | |||
961 962 963 964 965 966 967 968 969 970 971 972 973 974 | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | + | setText (sText) { this.clear(); oGrammalecte.oGCPanel.addMessageToGCPanel("⛔ Aucun champ textuel défini. Les changements ne seront pas répercutés sur la zone d’où le texte a été extrait."); this.loadText(sText); } loadText (sText) { // function also used by the text formatter if (typeof(sText) === "string") { this.dParagraph.clear(); let i = 0; let iStart = 0; let iEnd = 0; sText = sText.replace(/\r\n/g, "\n").replace(/\r/g, "\n").normalize("NFC"); while ((iEnd = sText.indexOf("\n", iStart)) !== -1) { |
︙ | |||
1005 1006 1007 1008 1009 1010 1011 | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | - + - - | this.xNode.removeChild(this.xNode.firstChild); } } write () { if (this.xNode !== null) { if (this.bResultInEvent) { |
︙ |