Grammalecte  Check-in [4553dac0b4]

Overview
Comment:[tb][fx] editor & text formatter: update for MailExtension
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | fx | mailext
Files: files | file ages | folders
SHA3-256: 4553dac0b4ed1973fe51fdd754de4ad4acdb87586aea2df14d049a670ecc4906
User & Date: olr on 2020-07-09 14:56:38
Other Links: branch diff | manifest | tags
Context
2020-07-09
15:01
[tb][fx] don’t show clipboard button for MailExtension check-in: 9195e062fb user: olr tags: fx, mailext, tb
14:56
[tb][fx] editor & text formatter: update for MailExtension check-in: 4553dac0b4 user: olr tags: fx, mailext, tb
13:07
[tb][fx] adapt conjugueur to MailExtension -> no input allowed in compose scripts check-in: 53f7b50983 user: olr tags: fx, mailext, tb
Changes

Modified gc_lang/fr/webext/content_scripts/editor.js from [4bcac7be9b] to [4d321e586a].

    65     65   
    66     66       getText () {
    67     67           try {
    68     68               let sPageText = "";
    69     69               for (let [i, sLine] of this.getParagraphs()) {
    70     70                   sPageText += sLine + "\n";
    71     71               }
    72         -            return sPageText;
           72  +            return sPageText.slice(0,-1).normalize("NFC");
    73     73           }
    74     74           catch (e) {
    75     75               showError(e);
    76     76           }
    77     77       }
    78     78   
    79     79       getParagraph (iPara) {
................................................................................
    83     83           catch (e) {
    84     84               showError(e);
    85     85           }
    86     86       }
    87     87   
    88     88       setParagraph (iPara, sText) {
    89     89           try {
    90         -            return this.lNode[iPara].textContent = oGrammalecte.purgeText(sText);
           90  +            if (iPara < this.lNode.length) {
           91  +                this.lNode[iPara].textContent = oGrammalecte.purgeText(sText).normalize("NFC");
           92  +            }
    91     93           }
    92     94           catch (e) {
    93     95               showError(e);
    94     96           }
    95     97       }
    96     98   
    97     99       changeParagraph (iPara, sModif, iStart, iEnd) {
    98    100           let sText = this.getParagraph(iPara);
    99    101           this.writeParagraph(iPara, sText.slice(0, iStart) + sModif + sText.slice(iEnd));
   100    102       }
          103  +
          104  +    loadText (sText) {
          105  +        let lParagraphs = sText.split("\n");
          106  +        for (let iPara = 0;  iPara < lParagraphs.length;  iPara++) {
          107  +            this.setParagraph(iPara, lParagraphs[iPara]);
          108  +        }
          109  +    }
   101    110   
   102    111       clear () {
   103    112           this.xDocument = null;
   104    113           this.xRootNode = null;
   105    114           this.lNode.length = 0;
   106    115       }
   107    116   }
................................................................................
   187    196       }
   188    197   
   189    198       getText () {
   190    199           return [...this.dParagraph.values()].join("\n").normalize("NFC");
   191    200       }
   192    201   
   193    202       setParagraph (iParagraph, sText) {
   194         -        this.dParagraph.set(iParagraph, oGrammalecte.purgeText(sText));
          203  +        this.dParagraph.set(iParagraph, oGrammalecte.purgeText(sText).normalize("NFC"));
   195    204           this.write();
   196    205       }
   197    206   
   198    207       getParagraph (iParaNum) {
   199    208           return this.dParagraph.get(iParaNum);
   200    209       }
   201    210