Index: gc_lang/fr/webext/background.js ================================================================== --- gc_lang/fr/webext/background.js +++ gc_lang/fr/webext/background.js @@ -216,10 +216,16 @@ xGCEWorker.postMessage(oRequest); break; case "openURL": browser.tabs.create({url: dParam.sURL}); break; + case "openConjugueurTab": + openConjugueurTab(); + break; + case "openLexiconEditor": + openLexiconEditor(dParam["dictionary"]); + break; default: console.log("[background] Unknown command: " + sCommand); console.log(oRequest); } //sendResponse({response: "response from background script"}); @@ -227,10 +233,11 @@ browser.runtime.onMessage.addListener(handleMessage); function handleConnexion (xPort) { + // Messages from tabs let iPortId = xPort.sender.tab.id; // identifier for the port: each port can be found at dConnx[iPortId] dConnx.set(iPortId, xPort); xPort.onMessage.addListener(function (oRequest) { let {sCommand, dParam, dInfo} = oRequest; switch (sCommand) { @@ -349,15 +356,27 @@ break; case "conjugueur_window": openConjugueurWindow(); break; case "lex_editor": - openLexEditor(); + openLexiconEditor(); break; } }); + +/* + Lexicon editor tab +*/ +let nTabLexiconEditor = null; + +browser.tabs.onRemoved.addListener(function (nTabId, xRemoveInfo) { + if (nTabId === nTabLexiconEditor) { + nTabLexiconEditor = null; + } +}); + /* Actions */ @@ -371,21 +390,28 @@ function sendCommandToTab (sCommand, iTab) { let xTabPort = dConnx.get(iTab); xTabPort.postMessage({sActionDone: sCommand, result: null, dInfo: null, bEnd: false, bError: false}); } -function openLexEditor () { - if (bChrome) { - browser.tabs.create({ +function openLexiconEditor (sName="__personal__") { + if (nTabLexiconEditor === null) { + if (bChrome) { + browser.tabs.create({ + url: browser.extension.getURL("panel/lex_editor.html") + }, onLexiconEditorOpened); + return; + } + let xLexEditor = browser.tabs.create({ url: browser.extension.getURL("panel/lex_editor.html") }); - return; + xLexEditor.then(onLexiconEditorOpened, onError); } - let xLexEditor = browser.tabs.create({ - url: browser.extension.getURL("panel/lex_editor.html") - }); - xLexEditor.then(onCreated, onError); +} + +function onLexiconEditorOpened (xTab) { + //console.log(xTab); + nTabLexiconEditor = xTab.id; } function openConjugueurTab () { if (bChrome) { browser.tabs.create({ @@ -422,7 +448,7 @@ function onCreated (xWindowInfo) { //console.log(`Created window: ${xWindowInfo.id}`); } function onError (error) { - console.log(`Error: ${error}`); + console.log(error); } Index: gc_lang/fr/webext/panel/main.css ================================================================== --- gc_lang/fr/webext/panel/main.css +++ gc_lang/fr/webext/panel/main.css @@ -84,11 +84,11 @@ } body { width: 450px; height: 500px; } -/* +/* Maximal height of a panel in WebExtention seems to be 500px. When going over this limit, a scrollbar appears which destructs the horizontal balance of elements. --> vertical scrolling is done with overflow in #page. #page must have the same height than body. @@ -245,10 +245,29 @@ font-size: 16px; text-align: center; cursor: pointer; } + +.option_section { + padding: 10px; + margin-top: 10px; + border-radius: 5px; + background-color: hsl(210, 20%, 96%); +} +.option_section label { + font-size: 16px; + line-height: 20px; + color: hsl(210, 20%, 50%); + font-weight: bold; +} +.option_description { + padding: 0 0 0 20px; + color: hsl(0, 0%, 0%); + font-size: 12px; +} + /* Spell checking options */ #sc_options_page { @@ -265,30 +284,19 @@ #sc_options_page h2 { margin-top: 20px; font: normal 22px 'Yanone Kaffeesatz', "Oswald", "Liberation Sans Narrow", sans-serif; color: hsl(210, 50%, 50%); } - -/* - Options -*/ -.option_section { - padding: 10px; - margin-top: 10px; - border-radius: 5px; - background-color: hsl(210, 20%, 96%); -} -.option_section label { - font-size: 16px; - line-height: 20px; - color: hsl(210, 20%, 50%); - font-weight: bold; -} -.option_description { - padding: 0 0 0 20px; - color: hsl(0, 0%, 0%); - font-size: 12px; +.dic_button { + float: right; + padding: 2px 10px; + background-color: hsl(210, 50%, 50%); + color: hsl(210, 10%, 96%); + cursor: pointer; + font-size: 14px; + font-variant-caps: small-caps; + border-radius: 3px; } /* Test page @@ -372,11 +380,11 @@ .double-bounce2 { animation-delay: -1.0s; } @keyframes sk-bounce { - 0%, 100% { + 0%, 100% { transform: scale(0.0); - } 50% { + } 50% { transform: scale(1.0); } } Index: gc_lang/fr/webext/panel/main.html ================================================================== --- gc_lang/fr/webext/panel/main.html +++ gc_lang/fr/webext/panel/main.html @@ -106,22 +106,23 @@

OPTIONS ORTHOGRAPHIQUES

DICTIONNAIRES DE GRAMMALECTE

-

Ces dictionnaires ne sont utilisés que lors de l’analyse grammaticale.

-

-

Environ 83 000 entrées, 500 000 flexions.
Ni éditable, ni désactivable.

+

+

Environ 83 000 entrées, 500 000 flexions.
Ni éditable, ni désactivable.
Ce dictionnaire est créé à partir du dictionnaire orthographique pour Firefox et LibreOffice, conçu sur le site de Grammalecte.

-
-

-

Fonctionnalité à venir.

+
+

+
Éditer
+

Ce dictionnaire est créé et édité via l’éditeur lexical et est sauvegardé sur un serveur en ligne accessible à tous les membres.

-

Ce dictionnaire est créé et édité via l’éditeur lexical.

+
Éditer
+

Ce dictionnaire est créé et édité via l’éditeur lexical et n’est pas partagé.