diff --git a/Dockerfile b/Dockerfile
index b2594e8db..d868071c9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:12.16.0-alpine
+FROM node:12.16.1-alpine
# Create app directory
WORKDIR /usr/src/app
diff --git a/bin/build-linux-x64.sh b/bin/build-linux-x64.sh
index 473dd5c04..69d595cbe 100755
--- a/bin/build-linux-x64.sh
+++ b/bin/build-linux-x64.sh
@@ -11,11 +11,9 @@ echo "Copying required linux-x64 binaries"
rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
-rm -r $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/*
cp -r bin/deps/linux-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
cp bin/deps/linux-x64/image/pngquant $SRC_DIR/node_modules/pngquant-bin/vendor/
-cp bin/deps/linux-x64/spellchecker/* $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite
diff --git a/bin/build-mac-x64.sh b/bin/build-mac-x64.sh
index 950ac086c..1d3ecc766 100755
--- a/bin/build-mac-x64.sh
+++ b/bin/build-mac-x64.sh
@@ -13,15 +13,11 @@ rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
rm -r $SRC_DIR/node_modules/mozjpeg/vendor/*
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
rm -r $SRC_DIR/node_modules/giflossy/vendor/*
-rm -r $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/*
-rm -r $SRC_DIR/node_modules/keyboard-layout/build/Release/*
cp -r bin/deps/mac-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
cp bin/deps/mac-x64/image/cjpeg $SRC_DIR/node_modules/mozjpeg/vendor/
cp bin/deps/mac-x64/image/pngquant $SRC_DIR/node_modules/pngquant-bin/vendor/
cp bin/deps/mac-x64/image/gifsicle $SRC_DIR/node_modules/giflossy/vendor/
-cp bin/deps/mac-x64/spellchecker/* $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/
-cp bin/deps/mac-x64/keyboard-layout-manager.node $SRC_DIR/node_modules/keyboard-layout/build/Release/
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=darwin --arch=x64 --overwrite --icon=images/app-icons/mac/icon.icns
diff --git a/bin/build-server.sh b/bin/build-server.sh
index 49a99ea03..d5c5eac4d 100755
--- a/bin/build-server.sh
+++ b/bin/build-server.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
PKG_DIR=dist/trilium-linux-x64-server
-NODE_VERSION=12.16.0
+NODE_VERSION=12.16.1
if [ "$1" != "DONTCOPY" ]
then
diff --git a/bin/build-win-x64.sh b/bin/build-win-x64.sh
index c328d1731..db3d555b2 100755
--- a/bin/build-win-x64.sh
+++ b/bin/build-win-x64.sh
@@ -13,16 +13,11 @@ rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
rm -r $SRC_DIR/node_modules/mozjpeg/vendor/*
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
rm -r $SRC_DIR/node_modules/giflossy/vendor/*
-rm -r $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/*
-rm -r $SRC_DIR/node_modules/keyboard-layout/build/Release/*
-rm -r $SRC_DIR/node_modules/cld/build/Release/*
cp -r bin/deps/win-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
cp bin/deps/win-x64/image/cjpeg.exe $SRC_DIR/node_modules/mozjpeg/vendor/
cp bin/deps/win-x64/image/pngquant.exe $SRC_DIR/node_modules/pngquant-bin/vendor/
cp bin/deps/win-x64/image/gifsicle.exe $SRC_DIR/node_modules/giflossy/vendor/
-cp bin/deps/win-x64/spellchecker/* $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/
-cp bin/deps/win-x64/keyboard-layout-manager.node $SRC_DIR/node_modules/keyboard-layout/build/Release/
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=win32 --arch=x64 --overwrite --icon=images/app-icons/win/icon.ico
diff --git a/bin/copy-trilium.sh b/bin/copy-trilium.sh
index 70cdee57d..da67db727 100755
--- a/bin/copy-trilium.sh
+++ b/bin/copy-trilium.sh
@@ -26,7 +26,4 @@ cp -r electron.js $DIR/
# run in subshell (so we return to original dir)
(cd $DIR && npm install --only=prod)
-rm -r $DIR/node_modules/cld/deps
-
-find $DIR/libraries -name "*.map" -type f -delete
-find $DIR/libraries -name "hunspell.lib" -type f -delete
\ No newline at end of file
+find $DIR/libraries -name "*.map" -type f -delete
\ No newline at end of file
diff --git a/bin/deps/linux-x64/spellchecker/hunspell.a b/bin/deps/linux-x64/spellchecker/hunspell.a
deleted file mode 100644
index d3e3e2515..000000000
Binary files a/bin/deps/linux-x64/spellchecker/hunspell.a and /dev/null differ
diff --git a/bin/deps/linux-x64/spellchecker/spellchecker.node b/bin/deps/linux-x64/spellchecker/spellchecker.node
deleted file mode 100644
index bebf4fa7e..000000000
Binary files a/bin/deps/linux-x64/spellchecker/spellchecker.node and /dev/null differ
diff --git a/bin/deps/mac-x64/keyboard-layout-manager.node b/bin/deps/mac-x64/keyboard-layout-manager.node
deleted file mode 100644
index 3c2882dcc..000000000
Binary files a/bin/deps/mac-x64/keyboard-layout-manager.node and /dev/null differ
diff --git a/bin/deps/mac-x64/spellchecker/hunspell.a b/bin/deps/mac-x64/spellchecker/hunspell.a
deleted file mode 100644
index 116af7a8b..000000000
Binary files a/bin/deps/mac-x64/spellchecker/hunspell.a and /dev/null differ
diff --git a/bin/deps/mac-x64/spellchecker/spellchecker.node b/bin/deps/mac-x64/spellchecker/spellchecker.node
deleted file mode 100644
index fe11eb3ce..000000000
Binary files a/bin/deps/mac-x64/spellchecker/spellchecker.node and /dev/null differ
diff --git a/bin/deps/win-x64/keyboard-layout-manager.node b/bin/deps/win-x64/keyboard-layout-manager.node
deleted file mode 100755
index 2b7c9bb2b..000000000
Binary files a/bin/deps/win-x64/keyboard-layout-manager.node and /dev/null differ
diff --git a/bin/deps/win-x64/spellchecker/hunspell.lib b/bin/deps/win-x64/spellchecker/hunspell.lib
deleted file mode 100755
index d013a8742..000000000
Binary files a/bin/deps/win-x64/spellchecker/hunspell.lib and /dev/null differ
diff --git a/bin/deps/win-x64/spellchecker/spellchecker.lib b/bin/deps/win-x64/spellchecker/spellchecker.lib
deleted file mode 100755
index 848c968d4..000000000
Binary files a/bin/deps/win-x64/spellchecker/spellchecker.lib and /dev/null differ
diff --git a/bin/deps/win-x64/spellchecker/spellchecker.node b/bin/deps/win-x64/spellchecker/spellchecker.node
deleted file mode 100755
index 80d668c5d..000000000
Binary files a/bin/deps/win-x64/spellchecker/spellchecker.node and /dev/null differ
diff --git a/package-lock.json b/package-lock.json
index 5de5daa81..d505faae5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2669,9 +2669,9 @@
"integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA=="
},
"electron": {
- "version": "9.0.0-beta.3",
- "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.0-beta.3.tgz",
- "integrity": "sha512-se2XiC3sc6o8EUL/uE7bOknW7/gh37mQ+7uX8idugfYyK1oCISfr5CqtVXOMNTwMtx0opdFQ1HFC+W2ckNiPXg==",
+ "version": "9.0.0-beta.4",
+ "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.0-beta.4.tgz",
+ "integrity": "sha512-XznzkZ8nWTclg7B/Bue8PgXPyaYygZvtIqiNSmI3mgJ710F69RO2IrM3Rs1ULS3qWA3sTDY6PO0UPyUeTxhP7g==",
"dev": true,
"requires": {
"@electron/get": "^1.0.1",
diff --git a/package.json b/package.json
index 42170b04e..ee96d214a 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,6 @@
"electron-debug": "3.0.1",
"electron-dl": "3.0.0",
"electron-find": "1.0.6",
- "electron-spellchecker": "2.2.1",
"electron-window-state": "5.0.3",
"express": "4.17.1",
"express-session": "1.17.0",
@@ -75,7 +74,7 @@
"ws": "7.2.1"
},
"devDependencies": {
- "electron": "9.0.0-beta.3",
+ "electron": "9.0.0-beta.4",
"electron-builder": "22.3.2",
"electron-packager": "14.2.1",
"electron-rebuild": "1.10.0",
diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.js
index bcd977b7e..0f2df5ba1 100644
--- a/src/public/javascripts/desktop.js
+++ b/src/public/javascripts/desktop.js
@@ -66,6 +66,7 @@ import RenderTypeWidget from "./widgets/type_widgets/render.js";
import RelationMapTypeWidget from "./widgets/type_widgets/relation_map.js";
import ProtectedSessionTypeWidget from "./widgets/type_widgets/protected_session.js";
import BookTypeWidget from "./widgets/type_widgets/book.js";
+import contextMenuService from "./services/context_menu.js";
if (utils.isElectron()) {
require('electron').ipcRenderer.on('globalShortcut', async function(event, actionName) {
@@ -83,4 +84,44 @@ appContext.start();
noteTooltipService.setupGlobalTooltip();
-noteAutocompleteService.init();
\ No newline at end of file
+noteAutocompleteService.init();
+
+if (utils.isElectron()) {
+ const {webContents} = require('electron').remote.getCurrentWindow();
+
+ webContents.on('context-menu', (event, params) => {
+ const items = [
+ {title: "Hello", cmd: "openNoteInNewTab", uiIcon: "arrow-up-right"}
+ ];
+
+ if (params.misspelledWord) {
+ items.push({
+ title: `Misspelled "${params.misspelledWord}"`,
+ cmd: "openNoteInNewTab",
+ uiIcon: ""
+ });
+
+ for (const suggestion of params.dictionarySuggestions) {
+ items.push({
+ title: suggestion,
+ command: "replaceMisspelling",
+ spellingSuggestion: suggestion,
+ uiIcon: ""
+ });
+ }
+ }
+
+ contextMenuService.initContextMenu({
+ x: params.x,
+ y: params.y,
+ items,
+ selectContextMenuItem: (e, {command, spellingSuggestion}) => {
+ if (command === 'replaceMisspelling') {
+ console.log("Replacing missspeling", spellingSuggestion);
+
+ require('electron').remote.getCurrentWindow().webContents.insertText(spellingSuggestion);
+ }
+ }
+ });
+ });
+}
\ No newline at end of file
diff --git a/src/public/javascripts/dialogs/options/other.js b/src/public/javascripts/dialogs/options/other.js
index 5d366eb3e..b2b2a7050 100644
--- a/src/public/javascripts/dialogs/options/other.js
+++ b/src/public/javascripts/dialogs/options/other.js
@@ -16,11 +16,11 @@ const TPL = `
Changes to the spell check options will take effect after application restart.
+Multiple languages can be separated by comman. Changes to the spell check options will take effect after application restart.