From 5828062915dfa62318f1570351887a750f65e8c1 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 24 May 2019 10:04:03 +0200 Subject: feat(App): Bump electron to 5.0.1 --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'package.json') diff --git a/package.json b/package.json index c1a8c310f..245eb71d6 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "dependencies": { "@babel/polyfill": "^7.0.0", "@babel/runtime": "^7.0.0", - "@meetfranz/electron-notification-state": "^1.0.0", + "@meetfranz/electron-notification-state": "1.0.0", "@meetfranz/forms": "file:packages/forms", "@meetfranz/theme": "file:packages/theme", "@meetfranz/ui": "file:packages/ui", @@ -117,8 +117,8 @@ "cross-env": "^5.0.5", "cz-conventional-changelog": "2.1.0", "dotenv": "^4.0.0", - "electron": "4.1.4", - "electron-builder": "20.38.4", + "electron": "5.0.2", + "electron-builder": "20.40.2", "electron-rebuild": "1.8.4", "eslint": "5.10.0", "eslint-config-airbnb": "17.1.0", -- cgit v1.2.3-70-g09d2 From 830b6f88f3d30708cf0264375b8db5b2e5714218 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Wed, 5 Jun 2019 17:18:52 +0200 Subject: Fix spellchecker integration --- package-lock.json | 50 ++++++++++++++++++++++++++++++--------------- package.json | 2 +- src/webview/contextMenu.js | 5 +++-- src/webview/spellchecker.js | 18 ++++++++++------ 4 files changed, 50 insertions(+), 25 deletions(-) (limited to 'package.json') diff --git a/package-lock.json b/package-lock.json index 54f49fd0d..2a2c83bc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7036,14 +7036,12 @@ } }, "electron-hunspell": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/electron-hunspell/-/electron-hunspell-0.1.1.tgz", - "integrity": "sha512-B3nOQqHexIX+8bz72FZkNk+iFBrdqS9DpV2SaH+t7T9SLbONBVBRLJ2Jj2ytXFUzvw81q7vz2dfxPCddh/E3ww==", + "version": "1.0.0-beta.7", + "resolved": "https://registry.npmjs.org/electron-hunspell/-/electron-hunspell-1.0.0-beta.7.tgz", + "integrity": "sha512-BByCXqU8sZbuzyoxKcBYjycp8ORiqjeYZd2OT8RNjVW+XGPmZkHewXUu4tUa1IXW6ij6IqojV5kr+xhYKLN1DA==", "requires": { - "hunspell-asm": "1.0.2", - "lodash": "^4.17.11", - "tslib": "1.9.3", - "unixify": "1.0.0" + "hunspell-asm": "^2.0.0", + "tslib": "1.9.3" } }, "electron-is-dev": { @@ -11374,14 +11372,34 @@ } }, "hunspell-asm": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/hunspell-asm/-/hunspell-asm-1.0.2.tgz", - "integrity": "sha512-UTLBvc0yZiIcHl9qrgxnFTZbX3zF4CprzEY+u+N0iXlUKZnUJRIgvgppTdgiQTsucm5b0aN/rHsgXz2q/0kBRA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hunspell-asm/-/hunspell-asm-2.0.0.tgz", + "integrity": "sha512-FMIUBpy+bRREFAvC63RcYEK9U6+FdlEojGSVsvMTpuZ2CekYyUBwEfG4+ExIQOQyEN0U6f1MoVgrFqvgPNSA2g==", "requires": { - "emscripten-wasm-loader": "^1.0.0", - "nanoid": "^1.0.2", - "tslib": "^1.9.0", + "emscripten-wasm-loader": "^2.2.3", + "nanoid": "^2.0.1", + "tslib": "^1.9.3", "unixify": "^1.0.0" + }, + "dependencies": { + "emscripten-wasm-loader": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/emscripten-wasm-loader/-/emscripten-wasm-loader-2.2.3.tgz", + "integrity": "sha512-//gI0afvtVnY7smttrPOW/BM+pTJLmdIcXAQV3fgRdQ0o6wm2vdSI0kjLYVOeo/rbtRsGgVuMLu6fT+O//EfaA==", + "requires": { + "getroot": "^1.0.0", + "nanoid": "^1.3.4", + "tslib": "^1.9.3", + "unixify": "^1.0.0" + }, + "dependencies": { + "nanoid": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-1.3.4.tgz", + "integrity": "sha512-4ug4BsuHxiVHoRUe1ud6rUFT3WUMmjXt1W0quL0CviZQANdan7D8kqN5/maw53hmAApY/jfzMRkC57BNNs60ZQ==" + } + } + } } }, "husky": { @@ -14360,9 +14378,9 @@ "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==" }, "nanoid": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-1.3.4.tgz", - "integrity": "sha512-4ug4BsuHxiVHoRUe1ud6rUFT3WUMmjXt1W0quL0CviZQANdan7D8kqN5/maw53hmAApY/jfzMRkC57BNNs60ZQ==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.0.3.tgz", + "integrity": "sha512-NbaoqdhIYmY6FXDRB4eYtDVC9Z9eCbn8TyaiC16LNKtpPv/aqa0tOPD8y6gNE4yUNnaZ7LLhYtXOev/6+cBtfw==" }, "nanomatch": { "version": "1.2.13", diff --git a/package.json b/package.json index 245eb71d6..d03de2f20 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "du": "^0.1.0", "electron-dl": "1.12.0", "electron-fetch": "1.3.0", - "electron-hunspell": "0.1.1", + "electron-hunspell": "1.0.0-beta.7", "electron-is-dev": "1.0.1", "electron-react-titlebar": "0.8.1", "electron-updater": "4.0.6", diff --git a/src/webview/contextMenu.js b/src/webview/contextMenu.js index a4a6ab899..967e8e667 100644 --- a/src/webview/contextMenu.js +++ b/src/webview/contextMenu.js @@ -280,12 +280,13 @@ const buildMenuTpl = (props, suggestions, isSpellcheckEnabled, defaultSpellcheck }; export default function contextMenu(spellcheckProvider, isSpellcheckEnabled, getDefaultSpellcheckerLanguage, getSpellcheckerLanguage) { - webContents.on('context-menu', (e, props) => { + webContents.on('context-menu', async (e, props) => { e.preventDefault(); let suggestions = []; if (spellcheckProvider && props.misspelledWord) { - suggestions = spellcheckProvider.getSuggestion(props.misspelledWord); + debug('Mispelled word', props.misspelledWord); + suggestions = await spellcheckProvider.getSuggestion(props.misspelledWord); debug('Suggestions', suggestions); } diff --git a/src/webview/spellchecker.js b/src/webview/spellchecker.js index 9158b3b94..64575753f 100644 --- a/src/webview/spellchecker.js +++ b/src/webview/spellchecker.js @@ -1,6 +1,8 @@ import { webFrame } from 'electron'; -import { SpellCheckerProvider } from 'electron-hunspell'; +import { attachSpellCheckProvider, SpellCheckerProvider } from 'electron-hunspell'; +import { ENVIRONMENT } from 'hunspell-asm'; import path from 'path'; +import { readFileSync } from 'fs'; import { DICTIONARY_PATH } from '../config'; import { SPELLCHECKER_LOCALES } from '../i18n/languages'; @@ -10,11 +12,12 @@ const debug = require('debug')('Franz:spellchecker'); let provider; let currentDict; let _isEnabled = false; +let attached; async function loadDictionary(locale) { try { const fileLocation = path.join(DICTIONARY_PATH, `hunspell-dict-${locale}/${locale}`); - await provider.loadDictionary(locale, `${fileLocation}.dic`, `${fileLocation}.aff`); + await provider.loadDictionary(locale, readFileSync(`${fileLocation}.dic`), readFileSync(`${fileLocation}.aff`)); debug('Loaded dictionary', locale, 'from', fileLocation); } catch (err) { console.error('Could not load dictionary', err); @@ -41,7 +44,7 @@ export async function switchDict(locale) { provider.unloadDictionary(locale); } loadDictionary(locale); - provider.switchDictionary(locale); + attached.switchLanguage(locale); debug('Switched dictionary to', locale); @@ -58,12 +61,15 @@ export default async function initialize(languageCode = 'en-us') { const locale = languageCode.toLowerCase(); debug('Init spellchecker'); - await provider.initialize(); - // await loadDictionaries(); + await provider.initialize({ environment: ENVIRONMENT.NODE }); + + debug('Attaching spellcheck provider'); + attached = await attachSpellCheckProvider(provider); debug('Available spellchecker dictionaries', provider.availableDictionaries); - switchDict(locale); + attached.switchLanguage(locale); + console.log('seas oida', attached, provider); return provider; } catch (err) { -- cgit v1.2.3-70-g09d2 From e0bc496133f4874dab5d784ec4b4e67437b4c918 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 5 Jun 2019 18:02:27 +0200 Subject: Update minor dependencies --- package-lock.json | 33 ++++++++++++++++++++------------- package.json | 4 ++-- 2 files changed, 22 insertions(+), 15 deletions(-) (limited to 'package.json') diff --git a/package-lock.json b/package-lock.json index fc328c4b4..2fd2e4681 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "franz", - "version": "5.0.1", + "version": "5.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -932,12 +932,19 @@ } }, "@babel/polyfill": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.2.5.tgz", - "integrity": "sha512-8Y/t3MWThtMLYr0YNC/Q76tqN1w30+b0uQMeFUYauG2UGTR19zyUtFrAzT23zNtBxPp+LbE5E/nwV/q/r3y6ug==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.4.tgz", + "integrity": "sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg==", "requires": { - "core-js": "^2.5.7", - "regenerator-runtime": "^0.12.0" + "core-js": "^2.6.5", + "regenerator-runtime": "^0.13.2" + }, + "dependencies": { + "core-js": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", + "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==" + } } }, "@babel/preset-env": { @@ -1020,11 +1027,11 @@ } }, "@babel/runtime": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.3.1.tgz", - "integrity": "sha512-7jGW8ppV0ant637pIqAcFfQDDH1orEPGJb8aXfUozuCU3QqX7rX4DA8iwrbPrR1hcH0FTTHz47yQnk+bl5xHQA==", + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz", + "integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==", "requires": { - "regenerator-runtime": "^0.12.0" + "regenerator-runtime": "^0.13.2" } }, "@babel/template": { @@ -16880,9 +16887,9 @@ } }, "regenerator-runtime": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", - "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==" + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", + "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==" }, "regenerator-transform": { "version": "0.13.3", diff --git a/package.json b/package.json index c1a8c310f..8908d59f6 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,8 @@ "author": "Stefan Malzner ", "license": "Apache-2.0", "dependencies": { - "@babel/polyfill": "^7.0.0", - "@babel/runtime": "^7.0.0", + "@babel/polyfill": "7.4.4", + "@babel/runtime": "7.4.5", "@meetfranz/electron-notification-state": "^1.0.0", "@meetfranz/forms": "file:packages/forms", "@meetfranz/theme": "file:packages/theme", -- cgit v1.2.3-70-g09d2 From 53e26cbebbb0c00c5d2d0faaeb40bd2f42e18336 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Thu, 6 Jun 2019 12:39:36 +0200 Subject: Use same email validation as on the api --- package-lock.json | 7 ++++++- package.json | 1 + src/helpers/validation-helpers.js | 10 ++-------- .../messages/src/helpers/validation-helpers.json | 20 ++++++++++---------- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'package.json') diff --git a/package-lock.json b/package-lock.json index fc328c4b4..a00e68da2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "franz", - "version": "5.0.1", + "version": "5.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -20034,6 +20034,11 @@ "builtins": "^1.0.3" } }, + "validator": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-11.0.0.tgz", + "integrity": "sha512-+wnGLYqaKV2++nUv60uGzUJyJQwYVOin6pn1tgEiFCeCQO60yeu3Og9/yPccbBX574kxIcEJicogkzx6s6eyag==" + }, "value-or-function": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz", diff --git a/package.json b/package.json index c1a8c310f..bfc06c005 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "smoothscroll-polyfill": "^0.3.4", "tar": "^4.0.2", "uuid": "^3.0.1", + "validator": "11.0.0", "ws": "6.2.1" }, "devDependencies": { diff --git a/src/helpers/validation-helpers.js b/src/helpers/validation-helpers.js index 2f762437d..ab2376b1b 100644 --- a/src/helpers/validation-helpers.js +++ b/src/helpers/validation-helpers.js @@ -1,4 +1,5 @@ import { defineMessages } from 'react-intl'; +import isEmail from 'validator/lib/isEmail'; const messages = defineMessages({ required: { @@ -30,14 +31,7 @@ export function required({ field }) { export function email({ field }) { const value = field.value.trim(); - let isValid = false; - - if (value !== '') { - isValid = Boolean(value.match(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,63}/i)); - } else { - isValid = true; - } - + const isValid = isEmail(value); return [isValid, window.franz.intl.formatMessage(messages.email, { field: field.label })]; } diff --git a/src/i18n/messages/src/helpers/validation-helpers.json b/src/i18n/messages/src/helpers/validation-helpers.json index 86bfe1500..6be1d33e9 100644 --- a/src/i18n/messages/src/helpers/validation-helpers.json +++ b/src/i18n/messages/src/helpers/validation-helpers.json @@ -4,11 +4,11 @@ "defaultMessage": "!!!Field is required", "file": "src/helpers/validation-helpers.js", "start": { - "line": 4, + "line": 5, "column": 12 }, "end": { - "line": 7, + "line": 8, "column": 3 } }, @@ -17,11 +17,11 @@ "defaultMessage": "!!!Email not valid", "file": "src/helpers/validation-helpers.js", "start": { - "line": 8, + "line": 9, "column": 9 }, "end": { - "line": 11, + "line": 12, "column": 3 } }, @@ -30,11 +30,11 @@ "defaultMessage": "!!!Not a valid URL", "file": "src/helpers/validation-helpers.js", "start": { - "line": 12, + "line": 13, "column": 7 }, "end": { - "line": 15, + "line": 16, "column": 3 } }, @@ -43,11 +43,11 @@ "defaultMessage": "!!!Too few characters", "file": "src/helpers/validation-helpers.js", "start": { - "line": 16, + "line": 17, "column": 13 }, "end": { - "line": 19, + "line": 20, "column": 3 } }, @@ -56,11 +56,11 @@ "defaultMessage": "!!!At least one is required", "file": "src/helpers/validation-helpers.js", "start": { - "line": 20, + "line": 21, "column": 15 }, "end": { - "line": 23, + "line": 24, "column": 3 } } -- cgit v1.2.3-70-g09d2 From 62e689e92476ea5c27383a0814cee17f0a50ddff Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 7 Jun 2019 12:42:37 +0200 Subject: Bump version to 5.2.0-beta.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package.json') diff --git a/package.json b/package.json index a0305554d..beddb9ae1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "franz", "productName": "Franz", "appId": "com.meetfranz.franz", - "version": "5.1.0", + "version": "5.2.0-beta.1", "description": "Messaging app for WhatsApp, Slack, Telegram, HipChat, Hangouts and many many more.", "copyright": "adlk x franz - Stefan Malzner", "main": "index.js", -- cgit v1.2.3-70-g09d2 From 3d2c3a228e07a484015e4cf0d4d968fb0155326b Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Wed, 12 Jun 2019 16:36:50 +0200 Subject: bump version to beta 2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package.json') diff --git a/package.json b/package.json index 3df95362d..9060c32db 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "franz", "productName": "Franz", "appId": "com.meetfranz.franz", - "version": "5.2.0-beta.1", + "version": "5.2.0-beta.2", "description": "Messaging app for WhatsApp, Slack, Telegram, HipChat, Hangouts and many many more.", "copyright": "adlk x franz - Stefan Malzner", "main": "index.js", -- cgit v1.2.3-70-g09d2 From 404c87a7952a8f2d4e13dc8ee6b8fb16b02df1c0 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 21 Jun 2019 13:15:49 +0200 Subject: Revert electron to 4.2.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package.json') diff --git a/package.json b/package.json index 9060c32db..8bf049be2 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "cross-env": "^5.0.5", "cz-conventional-changelog": "2.1.0", "dotenv": "^4.0.0", - "electron": "5.0.2", + "electron": "4.2.4", "electron-builder": "20.40.2", "electron-rebuild": "1.8.4", "eslint": "5.10.0", -- cgit v1.2.3-70-g09d2 From 10bf89053ff37f40fc7a7e1660d1a789a4a21cef Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 21 Jun 2019 13:16:32 +0200 Subject: Bump version to 5.2.0-beta.3 --- package-lock.json | 22 +++++++++++----------- package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'package.json') diff --git a/package-lock.json b/package-lock.json index 77575ad56..53b46196a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "franz", - "version": "5.2.0-beta.1", + "version": "5.2.0-beta.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2173,13 +2173,13 @@ "requires": { "@mdi/js": "^3.3.92", "@mdi/react": "^1.1.0", - "@meetfranz/theme": "^1.0.13", + "@meetfranz/theme": "^1.0.14", "react-html-attributes": "^1.4.3", "react-loader": "^2.4.5" }, "dependencies": { "@meetfranz/theme": { - "version": "1.0.13", + "version": "1.0.14", "bundled": true, "requires": { "color": "^3.1.0" @@ -2198,12 +2198,12 @@ "requires": { "@mdi/js": "^3.3.92", "@mdi/react": "^1.1.0", - "@meetfranz/theme": "^1.0.13", + "@meetfranz/theme": "^1.0.14", "react-loader": "^2.4.5" }, "dependencies": { "@meetfranz/theme": { - "version": "1.0.13", + "version": "1.0.14", "bundled": true, "requires": { "color": "^3.1.0" @@ -6803,9 +6803,9 @@ "dev": true }, "electron": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/electron/-/electron-5.0.2.tgz", - "integrity": "sha512-bUHKQhyuOen/q8iHTkrnzqB9CAwBDI+vHbeu21kpq2bqAD+t25yfrmUEcYHaPL4fZOAhk6nnRqskF6/Xd+aZxg==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/electron/-/electron-4.2.4.tgz", + "integrity": "sha512-d4wEwJluMsRyRgbukLmFVTb6l1J+mc3RLB1ctbpMlSWDFvs+zknPWa+cHBzTWwrdgwINLddr69qsAW1ku6FqYw==", "dev": true, "requires": { "@types/node": "^10.12.18", @@ -6814,9 +6814,9 @@ }, "dependencies": { "@types/node": { - "version": "10.14.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", - "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==", + "version": "10.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.9.tgz", + "integrity": "sha512-NelG/dSahlXYtSoVPErrp06tYFrvzj8XLWmKA+X8x0W//4MqbUyZu++giUG/v0bjAT6/Qxa8IjodrfdACyb0Fg==", "dev": true } } diff --git a/package.json b/package.json index 8bf049be2..e982c7542 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "franz", "productName": "Franz", "appId": "com.meetfranz.franz", - "version": "5.2.0-beta.2", + "version": "5.2.0-beta.3", "description": "Messaging app for WhatsApp, Slack, Telegram, HipChat, Hangouts and many many more.", "copyright": "adlk x franz - Stefan Malzner", "main": "index.js", -- cgit v1.2.3-70-g09d2 From c1e592e6f530eadf730a77e4fa551f4eb0dbf337 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Tue, 25 Jun 2019 13:00:16 +0200 Subject: Revert: fix spellchecker --- package-lock.json | 50 +++++++++++++++------------------------------ package.json | 2 +- src/webview/contextMenu.js | 5 ++--- src/webview/spellchecker.js | 17 ++++++--------- 4 files changed, 25 insertions(+), 49 deletions(-) (limited to 'package.json') diff --git a/package-lock.json b/package-lock.json index 53b46196a..b4d86c5e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7043,12 +7043,14 @@ } }, "electron-hunspell": { - "version": "1.0.0-beta.7", - "resolved": "https://registry.npmjs.org/electron-hunspell/-/electron-hunspell-1.0.0-beta.7.tgz", - "integrity": "sha512-BByCXqU8sZbuzyoxKcBYjycp8ORiqjeYZd2OT8RNjVW+XGPmZkHewXUu4tUa1IXW6ij6IqojV5kr+xhYKLN1DA==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/electron-hunspell/-/electron-hunspell-0.1.1.tgz", + "integrity": "sha512-B3nOQqHexIX+8bz72FZkNk+iFBrdqS9DpV2SaH+t7T9SLbONBVBRLJ2Jj2ytXFUzvw81q7vz2dfxPCddh/E3ww==", "requires": { - "hunspell-asm": "^2.0.0", - "tslib": "1.9.3" + "hunspell-asm": "1.0.2", + "lodash": "^4.17.11", + "tslib": "1.9.3", + "unixify": "1.0.0" } }, "electron-is-dev": { @@ -11379,34 +11381,14 @@ } }, "hunspell-asm": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hunspell-asm/-/hunspell-asm-2.0.0.tgz", - "integrity": "sha512-FMIUBpy+bRREFAvC63RcYEK9U6+FdlEojGSVsvMTpuZ2CekYyUBwEfG4+ExIQOQyEN0U6f1MoVgrFqvgPNSA2g==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hunspell-asm/-/hunspell-asm-1.0.2.tgz", + "integrity": "sha512-UTLBvc0yZiIcHl9qrgxnFTZbX3zF4CprzEY+u+N0iXlUKZnUJRIgvgppTdgiQTsucm5b0aN/rHsgXz2q/0kBRA==", "requires": { - "emscripten-wasm-loader": "^2.2.3", - "nanoid": "^2.0.1", - "tslib": "^1.9.3", + "emscripten-wasm-loader": "^1.0.0", + "nanoid": "^1.0.2", + "tslib": "^1.9.0", "unixify": "^1.0.0" - }, - "dependencies": { - "emscripten-wasm-loader": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/emscripten-wasm-loader/-/emscripten-wasm-loader-2.2.3.tgz", - "integrity": "sha512-//gI0afvtVnY7smttrPOW/BM+pTJLmdIcXAQV3fgRdQ0o6wm2vdSI0kjLYVOeo/rbtRsGgVuMLu6fT+O//EfaA==", - "requires": { - "getroot": "^1.0.0", - "nanoid": "^1.3.4", - "tslib": "^1.9.3", - "unixify": "^1.0.0" - }, - "dependencies": { - "nanoid": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-1.3.4.tgz", - "integrity": "sha512-4ug4BsuHxiVHoRUe1ud6rUFT3WUMmjXt1W0quL0CviZQANdan7D8kqN5/maw53hmAApY/jfzMRkC57BNNs60ZQ==" - } - } - } } }, "husky": { @@ -14385,9 +14367,9 @@ "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==" }, "nanoid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.0.3.tgz", - "integrity": "sha512-NbaoqdhIYmY6FXDRB4eYtDVC9Z9eCbn8TyaiC16LNKtpPv/aqa0tOPD8y6gNE4yUNnaZ7LLhYtXOev/6+cBtfw==" + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-1.3.4.tgz", + "integrity": "sha512-4ug4BsuHxiVHoRUe1ud6rUFT3WUMmjXt1W0quL0CviZQANdan7D8kqN5/maw53hmAApY/jfzMRkC57BNNs60ZQ==" }, "nanomatch": { "version": "1.2.13", diff --git a/package.json b/package.json index e982c7542..517dd1c6f 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "du": "^0.1.0", "electron-dl": "1.12.0", "electron-fetch": "1.3.0", - "electron-hunspell": "1.0.0-beta.7", + "electron-hunspell": "0.1.1", "electron-is-dev": "1.0.1", "electron-react-titlebar": "0.8.1", "electron-updater": "4.0.6", diff --git a/src/webview/contextMenu.js b/src/webview/contextMenu.js index 967e8e667..a4a6ab899 100644 --- a/src/webview/contextMenu.js +++ b/src/webview/contextMenu.js @@ -280,13 +280,12 @@ const buildMenuTpl = (props, suggestions, isSpellcheckEnabled, defaultSpellcheck }; export default function contextMenu(spellcheckProvider, isSpellcheckEnabled, getDefaultSpellcheckerLanguage, getSpellcheckerLanguage) { - webContents.on('context-menu', async (e, props) => { + webContents.on('context-menu', (e, props) => { e.preventDefault(); let suggestions = []; if (spellcheckProvider && props.misspelledWord) { - debug('Mispelled word', props.misspelledWord); - suggestions = await spellcheckProvider.getSuggestion(props.misspelledWord); + suggestions = spellcheckProvider.getSuggestion(props.misspelledWord); debug('Suggestions', suggestions); } diff --git a/src/webview/spellchecker.js b/src/webview/spellchecker.js index 417d1ea1a..9158b3b94 100644 --- a/src/webview/spellchecker.js +++ b/src/webview/spellchecker.js @@ -1,8 +1,6 @@ import { webFrame } from 'electron'; -import { attachSpellCheckProvider, SpellCheckerProvider } from 'electron-hunspell'; -import { ENVIRONMENT } from 'hunspell-asm'; +import { SpellCheckerProvider } from 'electron-hunspell'; import path from 'path'; -import { readFileSync } from 'fs'; import { DICTIONARY_PATH } from '../config'; import { SPELLCHECKER_LOCALES } from '../i18n/languages'; @@ -12,12 +10,11 @@ const debug = require('debug')('Franz:spellchecker'); let provider; let currentDict; let _isEnabled = false; -let attached; async function loadDictionary(locale) { try { const fileLocation = path.join(DICTIONARY_PATH, `hunspell-dict-${locale}/${locale}`); - await provider.loadDictionary(locale, readFileSync(`${fileLocation}.dic`), readFileSync(`${fileLocation}.aff`)); + await provider.loadDictionary(locale, `${fileLocation}.dic`, `${fileLocation}.aff`); debug('Loaded dictionary', locale, 'from', fileLocation); } catch (err) { console.error('Could not load dictionary', err); @@ -44,7 +41,7 @@ export async function switchDict(locale) { provider.unloadDictionary(locale); } loadDictionary(locale); - attached.switchLanguage(locale); + provider.switchDictionary(locale); debug('Switched dictionary to', locale); @@ -61,14 +58,12 @@ export default async function initialize(languageCode = 'en-us') { const locale = languageCode.toLowerCase(); debug('Init spellchecker'); - await provider.initialize({ environment: ENVIRONMENT.NODE }); - - debug('Attaching spellcheck provider'); - attached = await attachSpellCheckProvider(provider); + await provider.initialize(); + // await loadDictionaries(); debug('Available spellchecker dictionaries', provider.availableDictionaries); - attached.switchLanguage(locale); + switchDict(locale); return provider; } catch (err) { -- cgit v1.2.3-70-g09d2