Skip to content

Commit

Permalink
Merge pull request #23 from MicroPad/electron-v5
Browse files Browse the repository at this point in the history
Electron v5
  • Loading branch information
NickGeek authored Jun 29, 2019
2 parents 9424665 + 8e590fc commit 68738df
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 145 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ core/
dist/
main.js
preload.js
after-pack.js

.DS_store

Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "micropad",
"version": "3.19.1",
"version": "3.19.2",
"description": "A powerful note-taking app that helps you organise + take notes without restrictions.",
"main": "main.js",
"scripts": {
"start": "yarn build; npx electron . --is-dev",
"build": "npx tsc --target es6 --module CommonJS main.ts preload.ts",
"start": "yarn build; npx electron . --is-dev --no-sandbox",
"build": "npx tsc --skipLibCheck --target es2017 --module CommonJS main.ts preload.ts",
"update-core": "rm -rf core; rm -rf tmp; mkdir tmp; wget https://github.com/MicroPad/Web/releases/download/v${npm_package_version}/micropad.tar.xz -P ./tmp; cd tmp; tar -xf micropad.tar.xz; rm build/service-worker.js; rm build/*.map; rm build/static/*/*.map; cp -r build ../core; cd ..; rm -rf tmp",
"pack": "yarn build; npx electron-builder --dir",
"dist": "yarn build; npx electron-builder"
Expand All @@ -24,9 +24,10 @@
},
"homepage": "https://getmicropad.com",
"devDependencies": {
"electron": "^4.2.4",
"electron": "^5.0.4",
"electron-builder": "^20.43.0",
"typescript": "^3.5.1"
"promised-exec": "^1.0.1",
"typescript": "^3.5.2"
},
"dependencies": {
"dictionary-en-au": "^2.1.1",
Expand Down
18 changes: 10 additions & 8 deletions preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ async function initSpellcheck(): Promise<void> {
userDict = new Set(await localforage.getItem<string[]>('user dict'));

setTimeout(() => {
webFrame.setSpellCheckProvider('en-AU', false, {
spellCheck(word) {
// Don't spellcheck anything with a number in it
if (/\d/.test(word)) return true;
webFrame.setSpellCheckProvider('en-AU', {
spellCheck(words, callback) {
const misspelt = words
.filter(word => !/\d/.test(word)) // Don't spellcheck anything with a number in it
.filter(word => !(userDict.has(word) || dictAU.check(word) || dictUS.check(word)));

return userDict.has(word) || dictAU.check(word) || dictUS.check(word);
callback(misspelt);
}
});
}, 1000);
Expand Down Expand Up @@ -88,14 +89,15 @@ async function initSpellcheck(): Promise<void> {

function addSpellCheckMenuItem() {
const menu = remote.Menu.getApplicationMenu() as any;
// console.log((menu.getMenuItemById('edit-menu') as any).submenu);
menu.getMenuItemById('edit-menu').submenu.append(new remote.MenuItem({
type: 'checkbox',
label: 'Spell Checking',
checked: shouldSpellCheck,
click: menuItem => {
localforage.setItem<boolean>('should spell check', menuItem.checked);
alert(`When you restart MicroPad, the spell checker will be ${menuItem.checked ? 'enabled' : 'disabled'}.`);
localforage.setItem<boolean>('should spell check', menuItem.checked)
.then(() =>
alert(`When you restart MicroPad, the spell checker will be ${menuItem.checked ? 'enabled' : 'disabled'}.`)
);
}
}));
}
Expand Down
Loading

0 comments on commit 68738df

Please sign in to comment.