Grammalecte  Diff

Differences From Artifact [d81c939773]:

To Artifact [14a4e0411e]:


345
346
347
348
349
350
351
352
353
354

355
356
357
358
359
360
361
362
    if (sText.includes("<!-- err_end -->") || sText.includes('<span id="tooltip') || sText.includes('<u id="err')) {
        return false;
    }
    return true;
}

function checkAndSendToPanel (sIdParagraph, sText) {
    let xPromise = xGCEWorker.post('parseAndTag', [sText, parseInt(sIdParagraph), "FR", false]);
    xPromise.then(
        function (aVal) {

            xGCPanel.port.emit("refreshParagraph", sIdParagraph, aVal);
        },
        function (aReason) {
            console.error('Promise rejected - ', aReason);
        }
    ).catch(
        function (aCaught) {
            console.error('Promise Error - ', aCaught);







|


>
|







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
    if (sText.includes("<!-- err_end -->") || sText.includes('<span id="tooltip') || sText.includes('<u id="err')) {
        return false;
    }
    return true;
}

function checkAndSendToPanel (sIdParagraph, sText) {
    let xPromise = xGCEWorker.post('parseAndSpellcheck', [sText, "FR", false, false]);
    xPromise.then(
        function (aVal) {
            sText = text.addHtmlEntities(sText);
            xGCPanel.port.emit("refreshParagraph", sText, sIdParagraph, aVal);
        },
        function (aReason) {
            console.error('Promise rejected - ', aReason);
        }
    ).catch(
        function (aCaught) {
            console.error('Promise Error - ', aCaught);
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
    let iParagraph = 0; // index of paragraphs, used for identification
    let nParagraph = 0; // non empty paragraphs
    let sRes = "";
    try {
        sText = sText.normalize("NFC"); // remove combining diacritics
        for (let sParagraph of text.getParagraph(sText)) {
            if (sParagraph.trim() !== "") {
                sRes = await xGCEWorker.post('parseAndGenerateParagraph', [sParagraph, iParagraph, "FR", false])
                xGCPanel.port.emit("addElem", sRes);
                nParagraph += 1;
            }
            iParagraph += 1;
        }
        xGCPanel.port.emit("addElem", '<p class="message">' + _("numberOfParagraphs") + " " + nParagraph + '</p>');
    }
    catch (e) {
        xGCPanel.port.emit("addElem", '<p class="bug">' + e.message + '</p>');
    }
    xGCPanel.port.emit("end");
}


/*
    Text Formatter







|
|




|


|







415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
    let iParagraph = 0; // index of paragraphs, used for identification
    let nParagraph = 0; // non empty paragraphs
    let sRes = "";
    try {
        sText = sText.normalize("NFC"); // remove combining diacritics
        for (let sParagraph of text.getParagraph(sText)) {
            if (sParagraph.trim() !== "") {
                sRes = await xGCEWorker.post('parseAndSpellcheck', [sParagraph, "FR", false, false]);
                xGCPanel.port.emit("addParagraph", sParagraph, iParagraph, sRes);
                nParagraph += 1;
            }
            iParagraph += 1;
        }
        xGCPanel.port.emit("addMessage", 'message', _("numberOfParagraphs") + " " + nParagraph);
    }
    catch (e) {
        xGCPanel.port.emit("addMessage", 'bug', e.message);
    }
    xGCPanel.port.emit("end");
}


/*
    Text Formatter
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
    xLxgPanel.port.emit("addSeparator", _("separator"));
    loadGrammarChecker();
    let nParagraph = 0; // non empty paragraphs
    let sRes = "";
    try {
        for (let sParagraph of text.getParagraph(sText)) {
            if (sParagraph.trim() !== "") {
                sRes = await xGCEWorker.post('analyzeWords', [sParagraph])
                xLxgPanel.port.emit("addElem", sRes);
                nParagraph += 1;
            }
        }
        xLxgPanel.port.emit("addElem", '<p class="message">' + _("numberOfParagraphs") + " " + nParagraph + '</p>');
    }
    catch (e) {
        xLxgPanel.port.emit("addElem", '<p class="bug">'+e.message+"</p>");
    }
    xLxgPanel.port.emit("stopWaitIcon");
}


/*
    Conjugueur







|
|



|


|







568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
    xLxgPanel.port.emit("addSeparator", _("separator"));
    loadGrammarChecker();
    let nParagraph = 0; // non empty paragraphs
    let sRes = "";
    try {
        for (let sParagraph of text.getParagraph(sText)) {
            if (sParagraph.trim() !== "") {
                sRes = await xGCEWorker.post('getListOfElements', [sParagraph]);
                xLxgPanel.port.emit("addParagraphElems", sRes);
                nParagraph += 1;
            }
        }
        xLxgPanel.port.emit("addMessage", 'message', _("numberOfParagraphs") + " " + nParagraph);
    }
    catch (e) {
        xLxgPanel.port.emit("addMessage", 'bug', e.message);
    }
    xLxgPanel.port.emit("stopWaitIcon");
}


/*
    Conjugueur