ELECTRON-791 (Fix pop-out memory leak and move spellchecker module to main process) (#519)

* ELECTRON-791 - Bump electron version to 3.0.5 and change spellchecker module

* ELECTRON-791 - Remove AESDecryptGCM & AESEncryptGCM logs
This commit is contained in:
Kiran Niranjan
2018-10-22 22:34:48 +05:30
committed by Vishwas Shashidhar
parent 1089fe62c1
commit 7fea8b0383
6 changed files with 47 additions and 46 deletions

View File

@@ -1,7 +1,6 @@
const { remote } = require('electron');
const { MenuItem } = remote;
const { app, MenuItem } = require('electron');
const { isMac } = require('./../utils/misc');
const { SpellCheckHandler, ContextMenuListener, ContextMenuBuilder } = require('electron-spellchecker');
const { SpellCheckHandler } = require('electron-spellchecker');
const stringFormat = require('./../utils/stringFormat');
class SpellCheckHelper {
@@ -18,7 +17,6 @@ class SpellCheckHelper {
*/
initializeSpellChecker() {
this.spellCheckHandler.automaticallyIdentifyLanguages = false;
this.spellCheckHandler.attachToInput();
// This is only for window as in mac the
// language is switched w.r.t to the current system language.
@@ -26,14 +24,9 @@ class SpellCheckHelper {
// In windows we need to implement RxJS observable
// in order to switch language dynamically
if (!isMac) {
const sysLocale = remote.app.getLocale() || 'en-US';
const sysLocale = app.getLocale() || 'en-US';
this.spellCheckHandler.switchLanguage(sysLocale);
}
this.contextMenuBuilder = new ContextMenuBuilder(this.spellCheckHandler, null, false, this.processMenu.bind(this));
this.contextMenuListener = new ContextMenuListener((info) => {
this.contextMenuBuilder.showPopupMenu(info);
});
}
/**
@@ -42,7 +35,6 @@ class SpellCheckHelper {
*/
updateContextMenuLocale(content) {
this.localeContent = content;
this.contextMenuBuilder.setAlternateStringFormatter(SpellCheckHelper.getStringTable(content));
}
/**
@@ -51,7 +43,8 @@ class SpellCheckHelper {
* @param content {Object} - locale content for context menu
* @return {Object} - String table for context menu
*/
static getStringTable(content) {
// eslint-disable-next-line class-methods-use-this
getStringTable(content) {
return {
copyMail: () => content['Copy Email Address'] || `Copy Email Address`,
copyLinkUrl: () => content['Copy Link'] || 'Copy Link',