Compare commits

...
64 Commits
Author SHA1 Message Date
RiotRobot c19baadcd3 v1.7.26 2021-04-26 18:12:16 +01:00
RiotRobot ada58f826a Prepare changelog for v1.7.26 2021-04-26 18:12:15 +01:00
RiotRobot 6526127998 v1.7.26-rc.1 2021-04-21 17:48:52 +01:00
RiotRobot b640d5e7e4 Prepare changelog for v1.7.26-rc.1 2021-04-21 17:48:52 +01:00
Hubert Chathi 1ff5387f1d Merge pull request #170 from hiqua/develop
Remove Debian dependency libappindicator3-1
2021-04-19 14:06:19 -04:00
Germain 5ae736e861 Merge pull request #185 from vector-im/gsouquet-exit-shortcut
Fix exit shortcuts for non QWERTY keyboards
2021-04-15 17:25:44 +01:00
Germain Souquet 29d22aefd7 Fix exit shortcuts for non QWERTY keyboards 2021-04-15 16:50:35 +01:00
Germain 11602bb578 Merge pull request #182 from tsnowlan/remove-missing-setDebVersion 2021-04-14 11:40:38 +01:00
Tor Solli-NowlanandGermain 46ee80837a Update scripts/fetch-package.js
Co-authored-by: Germain <germain@souquet.com>
2021-04-14 12:34:53 +02:00
Tor Solli-Nowlan 97178f4297 setDebVersion function no longer exists
Signed-off-by: Tor Solli-Nowlan <tor.solli-nowlan@medisin.uio.no>
2021-04-13 12:22:32 +02:00
RiotRobot cd93f29691 Merge branch 'master' into develop 2021-04-12 15:35:40 +01:00
RiotRobot 48132c9eab v1.7.25 2021-04-12 15:35:26 +01:00
RiotRobot 4f58ba1b22 Prepare changelog for v1.7.25 2021-04-12 15:35:25 +01:00
Quentin Hibon 955be8417b Use libappindicator3-1 as Recommends dep 2021-04-10 22:48:37 +02:00
Quentin Hibon c136f2cafc Remove Debian dependency libappindicator3-1
libappindicator has been deprecated by Debian[0] and will not be shipped from
Debian Bullseye on.

[0]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037
2021-04-10 22:48:37 +02:00
Travis Ralston adfa845d9c Merge pull request #181 from vector-im/travis/no-staging
Switch nightly to not-staging Scalar by default
2021-04-07 10:31:18 -06:00
Travis Ralston 017cfd70f4 Switch nightly to not-staging Scalar by default 2021-04-07 10:21:33 -06:00
RiotRobot d63c27c50a v1.7.25-rc.1 2021-04-07 13:17:54 +01:00
RiotRobot 7edea00d4e Prepare changelog for v1.7.25-rc.1 2021-04-07 13:17:54 +01:00
J. Ryan Stinnett ce26e7964d Merge pull request #179 from SimonBrandner/disable-spell-check
Fix disabling spellchecker
2021-04-07 12:07:50 +01:00
Šimon Brandner 55dffc8c52 Fix disabling spellchecker
This is quite ugly. We have to use the store here to get this working since spellCheckerEnabled isn't persistent

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-04-02 12:07:33 +02:00
J. Ryan Stinnett 100f08161d Merge pull request #178 from vector-im/jryans/electron-12.0.2
Upgrade to Electron 12.0.2
2021-04-01 17:22:22 +01:00
Germain d4bf14b47f Merge pull request #177 from vector-im/gsouquet-exit-shortcut 2021-04-01 15:25:57 +01:00
J. Ryan Stinnett dabca5dc33 Upgrade electron-builder to 22.10.5
This upgrade will help prepare us for macOS aarch64 support
(https://github.com/vector-im/element-web/issues/16075) as well as pulling in
other smaller fixes.
2021-04-01 12:11:56 +01:00
J. Ryan Stinnett d11a7e77ac Upgrade to Electron 12.0.2
This is a [major release](https://www.electronjs.org/blog/electron-12-0)
upgrade. There are a few breaking changes, but none seem to affect us.

We believe moving to Electron 12 will help with some graphics issues on certain
systems.

Fixes https://github.com/vector-im/element-web/issues/15869
2021-04-01 12:11:56 +01:00
Germain Souquet adfb4a424a remove unused imports 2021-04-01 09:30:15 +01:00
Germain Souquet 5fc871492e make shortcut pressed variable more explanatory 2021-03-31 17:18:39 +01:00
Germain 3c68fe796f Merge pull request #176 from vector-im/gsouquet-docs
Migrate native-node-modules docs to element-desktop
2021-03-31 12:53:09 +01:00
GermainandJ. Ryan Stinnett a996aff19b Update punctuation for native module docs
Co-authored-by: J. Ryan Stinnett <jryans@gmail.com>
2021-03-31 12:51:22 +01:00
Germain Souquet 84990559ec Avoid exit listener to hijack other application shortcuts 2021-03-31 08:58:24 +01:00
Germain Souquet fdf216ca75 Clarify native modules build options 2021-03-30 09:38:19 +01:00
Germain Souquet f460cfa99a Migrate native-node-modules docs to element-desktop 2021-03-29 16:01:11 +01:00
RiotRobot d2bc3a8a03 Merge branch 'master' into develop 2021-03-29 13:49:40 +01:00
RiotRobot 6a107f7095 v1.7.24 2021-03-29 13:49:24 +01:00
RiotRobot ff4ebd4b39 Prepare changelog for v1.7.24 2021-03-29 13:49:24 +01:00
Germain 76eef82274 Merge pull request #173 from vector-im/gsouquet-warn-before-exit 2021-03-29 12:12:27 +01:00
Germain Souquet d986555517 Only prompt exit warning for keyboard shortcuts 2021-03-29 12:10:27 +01:00
J. Ryan Stinnett 939c5b4588 Merge pull request #172 from vector-im/jryans/electron-11.4.1
Upgrade to Electron 11.4.1
2021-03-26 09:59:56 +00:00
Germain f51001a460 Merge pull request #174 from vector-im/gsouquet-fix-dockerbuild-typo
Fix docker:build:native documentation typo
2021-03-25 17:38:42 +00:00
Germain db2fd9dd53 Fix docker:build:native documentation typo 2021-03-25 15:40:47 +00:00
Germain Souquet 3d18ff16d1 Attempt to minimise the window first rather than exiting 2021-03-25 14:50:33 +00:00
Germain Souquet 9cdea580d3 Remove checkbox options for exit dialog 2021-03-25 14:34:02 +00:00
Germain Souquet 68587e84ed Add user settings for warn before exit 2021-03-25 14:15:04 +00:00
J. Ryan Stinnett 58be4c62f7 Upgrade to Electron 11.4.1 2021-03-25 13:57:29 +00:00
Germain Souquet c9c0ceb757 Add prompt to warn before quitting the application 2021-03-25 12:46:10 +00:00
RiotRobot a46698559f v1.7.24-rc.1 2021-03-25 12:36:14 +00:00
RiotRobot c18b213699 Prepare changelog for v1.7.24-rc.1 2021-03-25 12:36:14 +00:00
RiotRobot b309562244 v1.7.23 2021-03-15 15:05:22 +00:00
RiotRobot 6c6a7d1bd6 Prepare changelog for v1.7.23 2021-03-15 15:05:21 +00:00
RiotRobot 6bff9f9a20 v1.7.23-rc.1 2021-03-11 10:13:06 +00:00
RiotRobot 42139ec30d Prepare changelog for v1.7.23-rc.1 2021-03-11 10:13:05 +00:00
J. Ryan Stinnett 6edc4cb965 Merge pull request #171 from SimonBrandner/fix-disabling-spell-check
Fix disabling spell-checker
2021-03-08 14:11:20 +00:00
Šimon Brandner 121bba1f35 Set an empty array to disable spell-checker
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-03-03 14:49:07 +01:00
J. Ryan Stinnett b8adc66898 Merge pull request #154 from SimonBrandner/feature-multi-language-spell-check
Add multi language spell check
2021-03-02 14:38:37 +00:00
Šimon Brandner 9ca19d7de6 Use getSpellCheckLanguages() instead of a setting
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-02-18 20:12:47 +01:00
Šimon Brandner dce524f5bc Use try-catch
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-02-18 18:39:51 +01:00
Šimon Brandner 48d66c0031 Merge branch 'feature-multi-language-spell-check' of https://github.com/SimonBrandner/element-desktop into feature-multi-language-spell-check 2021-02-18 18:30:37 +01:00
Šimon Brandner 36438479fc Merge branch 'develop' into feature-multi-language-spell-check 2021-02-18 18:25:21 +01:00
Šimon BrandnerandJ. Ryan Stinnett f51acb78e0 Update src/electron-main.js
Co-authored-by: J. Ryan Stinnett <jryans@gmail.com>
2021-02-18 18:05:37 +01:00
Šimon Brandner 62b6aa26ff Merge branch 'develop' into feature-multi-language-spell-check 2020-12-03 12:03:56 +01:00
Šimon Brandner 0d00f3ea6c Fix more formatting 2020-12-01 20:27:09 +01:00
Šimon Brandner 2ef3c8c1ab Fix formatting 2020-12-01 20:22:51 +01:00
Šimon Brandner e373c03b2a Cleanup 2020-12-01 20:19:12 +01:00
Šimon Brandner 107efba6f3 Added getAvailableSpellCheckLanguages case 2020-11-29 20:50:57 +01:00
10 changed files with 686 additions and 241 deletions

No files matched your search

+71
View File
@@ -1,3 +1,74 @@
Changes in [1.7.26](https://github.com/vector-im/element-desktop/releases/tag/v1.7.26) (2021-04-26)
===================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.26-rc.1...v1.7.26)
* No changes since rc.1
Changes in [1.7.26-rc.1](https://github.com/vector-im/element-desktop/releases/tag/v1.7.26-rc.1) (2021-04-21)
=============================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.25...v1.7.26-rc.1)
* Remove Debian dependency libappindicator3-1
[\#170](https://github.com/vector-im/element-desktop/pull/170)
* Fix exit shortcuts for non QWERTY keyboards
[\#185](https://github.com/vector-im/element-desktop/pull/185)
* Fix using yarn run fetch with a specific version
[\#182](https://github.com/vector-im/element-desktop/pull/182)
* Switch nightly to not-staging Scalar by default
[\#181](https://github.com/vector-im/element-desktop/pull/181)
Changes in [1.7.25](https://github.com/vector-im/element-desktop/releases/tag/v1.7.25) (2021-04-12)
===================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.25-rc.1...v1.7.25)
* No changes since rc.1
Changes in [1.7.25-rc.1](https://github.com/vector-im/element-desktop/releases/tag/v1.7.25-rc.1) (2021-04-07)
=============================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.24...v1.7.25-rc.1)
* Fix disabling spellchecker
[\#179](https://github.com/vector-im/element-desktop/pull/179)
* Upgrade to Electron 12.0.2
[\#178](https://github.com/vector-im/element-desktop/pull/178)
* Avoid exit listener to hijack other application shortcuts
[\#177](https://github.com/vector-im/element-desktop/pull/177)
* Migrate native-node-modules docs to element-desktop
[\#176](https://github.com/vector-im/element-desktop/pull/176)
* Add prompt to warn before quitting the application
[\#173](https://github.com/vector-im/element-desktop/pull/173)
* Upgrade to Electron 11.4.1
[\#172](https://github.com/vector-im/element-desktop/pull/172)
* Fix docker:build:native documentation typo
[\#174](https://github.com/vector-im/element-desktop/pull/174)
Changes in [1.7.24](https://github.com/vector-im/element-desktop/releases/tag/v1.7.24) (2021-03-29)
===================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.24-rc.1...v1.7.24)
* No changes since rc.1
Changes in [1.7.24-rc.1](https://github.com/vector-im/element-desktop/releases/tag/v1.7.24-rc.1) (2021-03-25)
=============================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.23...v1.7.24-rc.1)
* No changes since 1.7.23
Changes in [1.7.23](https://github.com/vector-im/element-desktop/releases/tag/v1.7.23) (2021-03-15)
===================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.23-rc.1...v1.7.23)
* No changes since rc.1
Changes in [1.7.23-rc.1](https://github.com/vector-im/element-desktop/releases/tag/v1.7.23-rc.1) (2021-03-11)
=============================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.22...v1.7.23-rc.1)
* Fix disabling spell-checker
[\#171](https://github.com/vector-im/element-desktop/pull/171)
* Add multi language spell check
[\#154](https://github.com/vector-im/element-desktop/pull/154)
Changes in [1.7.22](https://github.com/vector-im/element-desktop/releases/tag/v1.7.22) (2021-03-01) Changes in [1.7.22](https://github.com/vector-im/element-desktop/releases/tag/v1.7.22) (2021-03-01)
=================================================================================================== ===================================================================================================
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.22-rc.1...v1.7.22) [Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.22-rc.1...v1.7.22)
+1 -1
View File
@@ -96,7 +96,7 @@ yarn run docker:setup
yarn run docker:install yarn run docker:install
# if you want to build the native modules (this will take a while) # if you want to build the native modules (this will take a while)
yarn run docker:buildnative yarn run docker:build:native
yarn run docker:build yarn run docker:build
``` ```
+61
View File
@@ -0,0 +1,61 @@
# Native Node Modules
For some features, the desktop version of Element can make use of native Node
modules. These allow Element to integrate with the desktop in ways that a browser
cannot.
While native modules enable powerful new features, they must be complied for
each operating system. For official Element releases, we will always build these
modules from source to ensure we can trust the compiled output. In the future,
we may offer a pre-compiled path for those who want to use these features in a
custom build of Element without installing the various build tools required.
Do note that compiling a module for a particular operating system
(Linux/macOS/Windows) will need to be done on that operating system.
Cross-compiling from a host OS for a different target OS may be possible, but
we don't support this flow with Element dependencies at this time.
The process is automated by [vector-im/element-builder](https://github.com/vector-im/element-builder)
when releasing.
The following sections explain the manual steps you can use with a custom build of Element to enable
these features if you'd like to try them out.
It is possible to [build those native modules locally automatically](https://github.com/vector-im/element-desktop#building).
```
yarn run build:native
```
## Adding Seshat for search in E2E encrypted rooms
Seshat is a native Node module that adds support for local event indexing and
full text search in E2E encrypted rooms.
Since Seshat is written in Rust, the Rust compiler and related tools need to be
installed before installing Seshat itself. To install Rust please consult the
official Rust [documentation](https://www.rust-lang.org/tools/install).
Seshat also depends on the SQLCipher library to store its data in encrypted form
on disk. You'll need to install it via your OS package manager.
After installing the Rust compiler and SQLCipher, Seshat support can be added
using yarn at the root of this project:
yarn add matrix-seshat
You will have to rebuild the native libraries against electron's version of
of node rather than your system node, using the `electron-build-env` tool.
This is also needed to when pulling in changes to Seshat using `yarn link`.
yarn add electron-build-env
Recompiling Seshat itself can be done like so:
yarn run electron-build-env -- --electron 6.1.1 -- neon build matrix-seshat --release
Please make sure to include all the `--` as well as the `--release` command line
switch at the end. Modify your electron version accordingly depending on the
version that is installed on your system.
After this is done the Electron version of Element can be run from the main folder
as usual using:
yarn start
+2 -2
View File
@@ -2,8 +2,8 @@
"update_base_url": "https://packages.riot.im/nightly/update/", "update_base_url": "https://packages.riot.im/nightly/update/",
"default_server_name": "matrix.org", "default_server_name": "matrix.org",
"brand": "Element Nightly", "brand": "Element Nightly",
"integrations_ui_url": "https://scalar-staging.vector.im/", "integrations_ui_url": "https://scalar.vector.im/",
"integrations_rest_url": "https://scalar-staging.vector.im/api", "integrations_rest_url": "https://scalar.vector.im/api",
"integrations_widgets_urls": [ "integrations_widgets_urls": [
"https://scalar.vector.im/_matrix/integrations/v1", "https://scalar.vector.im/_matrix/integrations/v1",
"https://scalar.vector.im/api", "https://scalar.vector.im/api",
+2 -1
View File
@@ -3,7 +3,8 @@ License: Apache-2.0
Vendor: support@element.io Vendor: support@element.io
Architecture: amd64 Architecture: amd64
Maintainer: support@element.io Maintainer: support@element.io
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libappindicator3-1, libsecret-1-0, libsqlcipher0 Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libsecret-1-0, libsqlcipher0
Recommends: libappindicator3-1
Section: net Section: net
Priority: extra Priority: extra
Homepage: https://element.io/ Homepage: https://element.io/
+2 -1
View File
@@ -3,7 +3,8 @@ License: Apache-2.0
Vendor: support@element.io Vendor: support@element.io
Architecture: amd64 Architecture: amd64
Maintainer: support@element.io Maintainer: support@element.io
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libappindicator3-1, libsecret-1-0, libsqlcipher0 Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libsecret-1-0, libsqlcipher0
Recommends: libappindicator3-1
Replaces: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0) Replaces: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0)
Breaks: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0) Breaks: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0)
Section: net Section: net
+4 -4
View File
@@ -2,7 +2,7 @@
"name": "element-desktop", "name": "element-desktop",
"productName": "Element", "productName": "Element",
"main": "src/electron-main.js", "main": "src/electron-main.js",
"version": "1.7.22", "version": "1.7.26",
"description": "A feature-rich client for Matrix.org", "description": "A feature-rich client for Matrix.org",
"author": "Element", "author": "Element",
"repository": { "repository": {
@@ -39,8 +39,8 @@
}, },
"devDependencies": { "devDependencies": {
"asar": "^2.0.1", "asar": "^2.0.1",
"electron-builder": "22.9.1", "electron-builder": "22.10.5",
"electron-builder-squirrel-windows": "22.9.1", "electron-builder-squirrel-windows": "22.10.5",
"electron-devtools-installer": "^3.1.1", "electron-devtools-installer": "^3.1.1",
"electron-notarize": "^1.0.0", "electron-notarize": "^1.0.0",
"eslint": "7.3.1", "eslint": "7.3.1",
@@ -62,7 +62,7 @@
}, },
"build": { "build": {
"appId": "im.riot.app", "appId": "im.riot.app",
"electronVersion": "11.2.3", "electronVersion": "12.0.2",
"files": [ "files": [
"package.json", "package.json",
{ {
+1 -2
View File
@@ -15,7 +15,7 @@ const PUB_KEY_URL = "https://packages.riot.im/element-release-key.asc";
const PACKAGE_URL_PREFIX = "https://github.com/vector-im/element-web/releases/download/"; const PACKAGE_URL_PREFIX = "https://github.com/vector-im/element-web/releases/download/";
const ASAR_PATH = 'webapp.asar'; const ASAR_PATH = 'webapp.asar';
const {setPackageVersion, setDebVersion} = require('./set-version.js'); const {setPackageVersion} = require('./set-version.js');
async function getLatestDevelopUrl(bkToken) { async function getLatestDevelopUrl(bkToken) {
const buildsResult = await needle('get', const buildsResult = await needle('get',
@@ -283,7 +283,6 @@ async function main() {
const semVer = targetVersion.slice(1); const semVer = targetVersion.slice(1);
console.log("Updating version to " + semVer); console.log("Updating version to " + semVer);
await setPackageVersion(semVer); await setPackageVersion(semVer);
await setDebVersion(semVer);
} }
console.log("Done!"); console.log("Done!");
+62 -43
View File
@@ -27,7 +27,9 @@ const argv = require('minimist')(process.argv, {
alias: {help: "h"}, alias: {help: "h"},
}); });
const {app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol} = require('electron'); const {
app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol, dialog,
} = require('electron');
const AutoLaunch = require('auto-launch'); const AutoLaunch = require('auto-launch');
const path = require('path'); const path = require('path');
@@ -253,6 +255,30 @@ let eventIndex = null;
let mainWindow = null; let mainWindow = null;
global.appQuitting = false; global.appQuitting = false;
const exitShortcuts = [
(input, platform) => platform !== 'darwin' && input.alt && input.key.toUpperCase() === 'F4',
(input, platform) => platform !== 'darwin' && input.control && input.key.toUpperCase() === 'Q',
(input, platform) => platform === 'darwin' && input.meta && input.key.toUpperCase() === 'Q',
];
const warnBeforeExit = (event, input) => {
const shouldWarnBeforeExit = store.get('warnBeforeExit', true);
const exitShortcutPressed = exitShortcuts.some(shortcutFn => shortcutFn(input, process.platform));
if (shouldWarnBeforeExit && exitShortcutPressed) {
const shouldCancelCloseRequest = dialog.showMessageBoxSync(mainWindow, {
type: "question",
buttons: ["Cancel", "Close Element"],
message: "Are you sure you want to quit?",
defaultId: 1,
cancelId: 0,
}) === 0;
if (shouldCancelCloseRequest) {
event.preventDefault();
}
}
};
const deleteContents = async (p) => { const deleteContents = async (p) => {
for (const entry of await afs.readdir(p)) { for (const entry of await afs.readdir(p)) {
@@ -340,6 +366,12 @@ ipcMain.on('ipcCall', async function(ev, payload) {
launcher.disable(); launcher.disable();
} }
break; break;
case 'shouldWarnBeforeExit':
ret = store.get('warnBeforeExit', true);
break;
case 'setWarnBeforeExit':
store.set('warnBeforeExit', args[0]);
break;
case 'getMinimizeToTrayEnabled': case 'getMinimizeToTrayEnabled':
ret = tray.hasTray(); ret = tray.hasTray();
break; break;
@@ -385,50 +417,32 @@ ipcMain.on('ipcCall', async function(ev, payload) {
mainWindow.webContents.goForward(); mainWindow.webContents.goForward();
} }
break; break;
case 'setLanguage': { case 'setSpellCheckLanguages':
// work around `setSpellCheckerLanguages` being case-sensitive by converting to expected case if (args[0] && args[0].length > 0) {
const caseMap = {}; mainWindow.webContents.session.setSpellCheckerEnabled(true);
const availableLanguages = mainWindow.webContents.session.availableSpellCheckerLanguages; store.set("spellCheckerEnabled", true);
availableLanguages.forEach(lang => {
caseMap[lang.toLowerCase()] = lang;
});
if (!caseMap["en"]) { try {
// default special-case for `en` as in Riot is actually implies `en-GB`. `en-US` is distinct. mainWindow.webContents.session.setSpellCheckerLanguages(args[0]);
// this way if `en` is requested and not available and `en-GB` is available it'll be used. } catch (er) {
caseMap["en"] = caseMap["en-gb"]; console.log("There were problems setting the spellcheck languages", er);
}
const languages = new Set();
args[0].forEach(lang => {
const lcLang = lang.toLowerCase();
if (caseMap[lcLang]) {
languages.add(caseMap[lcLang]);
return;
} }
} else {
// as a fallback if the language is unknown check if the language group is known, e.g en for en-AU mainWindow.webContents.session.setSpellCheckerEnabled(false);
const langGroup = lcLang.split("-")[0]; store.set("spellCheckerEnabled", false);
if (caseMap[langGroup]) {
languages.add(caseMap[langGroup]);
return;
}
// as a further fallback, pick all other matching variants from the same language group
// this means that if we cannot find `ar-dz` or `ar` for example, we will pick `ar-*` to
// offer a spellcheck which is least likely to wrongly red underline something.
availableLanguages.forEach(availableLang => {
if (availableLang.startsWith(langGroup)) {
languages.add(availableLang);
}
});
});
if (languages.size > 0) {
mainWindow.webContents.session.setSpellCheckerLanguages([...languages]);
} }
break; break;
} case 'getSpellCheckLanguages':
if (store.get("spellCheckerEnabled", true)) {
ret = mainWindow.webContents.session.getSpellCheckerLanguages();
} else {
ret = [];
}
break;
case 'getAvailableSpellCheckLanguages':
ret = mainWindow.webContents.session.availableSpellCheckerLanguages;
break;
case 'startSSOFlow': case 'startSSOFlow':
recordSSOSession(args[0]); recordSSOSession(args[0]);
break; break;
@@ -923,12 +937,15 @@ app.on('ready', async () => {
enableRemoteModule: false, enableRemoteModule: false,
contextIsolation: true, contextIsolation: true,
webgl: false, webgl: false,
spellcheck: true,
}, },
}); });
mainWindow.loadURL('vector://vector/webapp/'); mainWindow.loadURL('vector://vector/webapp/');
Menu.setApplicationMenu(vectorMenu); Menu.setApplicationMenu(vectorMenu);
// Handle spellchecker
// For some reason spellCheckerEnabled isn't persisted so we have to use the store here
mainWindow.webContents.session.setSpellCheckerEnabled(store.get("spellCheckerEnabled", true));
// Create trayIcon icon // Create trayIcon icon
if (store.get('minimizeToTray', true)) tray.create(trayConfig); if (store.get('minimizeToTray', true)) tray.create(trayConfig);
@@ -943,10 +960,12 @@ app.on('ready', async () => {
} }
}); });
mainWindow.webContents.on('before-input-event', warnBeforeExit);
mainWindow.on('closed', () => { mainWindow.on('closed', () => {
mainWindow = global.mainWindow = null; mainWindow = global.mainWindow = null;
}); });
mainWindow.on('close', (e) => { mainWindow.on('close', async (e) => {
// If we are not quitting and have a tray icon then minimize to tray // If we are not quitting and have a tray icon then minimize to tray
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) { if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
// On Mac, closing the window just hides it // On Mac, closing the window just hides it
+480 -187
View File
File diff suppressed because it is too large. Load diff