Overview
| Comment: | [fx] recheck paragraph: don’t replace caret in the previous position if last edited paragraph is another one |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | fx |
| Files: | files | file ages | folders |
| SHA3-256: |
2b9b61bc322709850746c9d2dae80860 |
| User & Date: | olr on 2020-04-10 06:29:20 |
| Other Links: | manifest | tags |
Context
|
2020-04-10
| ||
| 09:47 | [fx] listen to port disconnection from background check-in: 7ca0d4636e user: olr tags: trunk, fx | |
| 06:29 | [fx] recheck paragraph: don’t replace caret in the previous position if last edited paragraph is another one check-in: 2b9b61bc32 user: olr tags: trunk, fx | |
| 06:28 | [fr] ajustements check-in: 0020cc9295 user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [6633e04592] to [229ed751b6].
| ︙ | |||
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | - + - + + |
grammalecte_error{Id} : [paragraph number]-[error_number]
grammalecte_sugg{Id} : [paragraph number]-[error_number]--[suggestion_number]
*/
constructor (...args) {
super(...args);
this.aIgnoredErrors = new Set();
|
| ︙ | |||
79 80 81 82 83 84 85 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - - + + |
// tabs
this.xTFButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Formateur de texte"});
this.xEditorButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur"});
this.xLxgButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Lexicographe"});
this.xConjButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Conjugueur"});
// buttons
this.xLexEditButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_subbutton", textContent: "ÉditLex", title: "Ouvrir l’éditeur lexical", style: "background-color: hsl(210, 50%, 40%)"});
|
| ︙ | |||
120 121 122 123 124 125 126 | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | - - - - + + + + |
this.showConjugueur();
}
};
this.xLexEditButton.onclick = () => {
oGrammalecteBackgroundPort.openLexiconEditor();
};
// Add tabs to menu
|
| ︙ | |||
236 237 238 239 240 241 242 243 244 245 246 247 248 249 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | + |
xParagraph.setAttribute("spellcheck", "false"); // doesn’t seem possible to use “spellcheck” as a common attribute.
xParagraph.dataset.timer_id = "0";
xParagraph.addEventListener("input", function (xEvent) {
if (this.bAutoRefresh) {
// timer for refreshing analysis
window.clearTimeout(parseInt(xParagraph.dataset.timer_id, 10));
xParagraph.dataset.timer_id = window.setTimeout(this.recheckParagraph.bind(this), 3000, oResult.iParaNum);
this.iLastEditedParagraph = oResult.iParaNum;
}
// write text
this.oTextControl.setParagraph(parseInt(xEvent.target.dataset.para_num, 10), this.purgeText(xEvent.target.textContent));
this.oTextControl.write();
}.bind(this)
, true);
this._tagParagraph(xParagraph, oResult.sParagraph, oResult.iParaNum, oResult.aGrammErr, oResult.aSpellErr);
|
| ︙ | |||
296 297 298 299 300 301 302 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | + - - + + |
// save caret position
let [nStart, nEnd] = oGrammalecte.getCaretPosition(xParagraph);
xParagraph.dataset.caret_position_start = nStart;
xParagraph.dataset.caret_position_end = nEnd;
// erase texte
xParagraph.textContent = "";
// recreate and retag
let sParaNum = sParagraphId.slice(21);
|
| ︙ | |||
385 386 387 388 389 390 391 | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | - + - + |
xParagraph.contentEditable = "false";
this.xParent.getElementById("grammalecte_check"+xParagraph.dataset.para_num).textContent = "!!";
this.xParent.getElementById("grammalecte_check"+xParagraph.dataset.para_num).style.backgroundColor = "hsl(0, 50%, 50%)";
this.xParent.getElementById("grammalecte_check"+xParagraph.dataset.para_num).style.boxShadow = "0 0 0 3px hsla(0, 0%, 50%, .2)";
this.xParent.getElementById("grammalecte_check"+xParagraph.dataset.para_num).style.animation = "grammalecte-pulse 1s linear infinite";
}
|
| ︙ | |||
411 412 413 414 415 416 417 418 419 420 421 422 423 424 | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | + |
xNodeErr.className = "grammalecte_error_corrected";
xNodeErr.removeAttribute("style");
let iParaNum = parseInt(sErrorId.slice(0, sErrorId.indexOf("-")), 10);
this.oTextControl.setParagraph(iParaNum, this.purgeText(this.xParent.getElementById("grammalecte_paragraph" + iParaNum).textContent));
this.oTextControl.write();
this.oTooltip.hide();
this.recheckParagraph(iParaNum);
this.iLastEditedParagraph = iParaNum;
}
catch (e) {
showError(e);
}
}
ignoreError (sIgnoreButtonId) { // ignore
|
| ︙ |