Skip to content

Commit

Permalink
Merge pull request #3 from mbuslenko/fix/0-0-9
Browse files Browse the repository at this point in the history
Fix/0.0.9 (v0.0.10)
  • Loading branch information
mbuslenko committed Jul 4, 2022
2 parents 645e3c6 + 0ccf980 commit bbb6c88
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodetools",
"version": "0.0.9",
"version": "0.0.10",
"description": "Personal all-hands assistant.",
"main": "./dist/main.js",
"scripts": {
Expand Down
33 changes: 33 additions & 0 deletions src/domains/inline/inline.domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export class InlineDomain {
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.C
);
await keyboard.releaseKey(
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.C
);

await new Promise((resolve) => setTimeout(resolve, 200)); // add a delay before checking clipboard
const selectedText = clipboard.readText();

Expand Down Expand Up @@ -75,6 +80,10 @@ export class InlineDomain {
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);
await keyboard.releaseKey(
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);

// wait for the clipboard to be updated
await new Promise((resolve) => setTimeout(resolve, 200));
Expand Down Expand Up @@ -104,6 +113,10 @@ export class InlineDomain {
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);
await keyboard.releaseKey(
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);

// wait for the clipboard to be updated
await new Promise((resolve) => setTimeout(resolve, 200));
Expand Down Expand Up @@ -150,6 +163,10 @@ export class InlineDomain {
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);
await keyboard.releaseKey(
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);

// wait for the clipboard to be updated
await new Promise((resolve) => setTimeout(resolve, 200));
Expand Down Expand Up @@ -177,6 +194,10 @@ export class InlineDomain {
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);
await keyboard.releaseKey(
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);

// wait for the clipboard to be updated
await new Promise((resolve) => setTimeout(resolve, 200));
Expand Down Expand Up @@ -208,6 +229,10 @@ export class InlineDomain {
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);
await keyboard.releaseKey(
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);

// wait for the clipboard to be updated
await new Promise((resolve) => setTimeout(resolve, 200));
Expand Down Expand Up @@ -242,6 +267,10 @@ export class InlineDomain {
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);
await keyboard.releaseKey(
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);

// wait for the clipboard to be updated
await new Promise((resolve) => setTimeout(resolve, 200));
Expand Down Expand Up @@ -288,6 +317,10 @@ export class InlineDomain {
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);
await keyboard.releaseKey(
process.platform === "darwin" ? Key.LeftSuper : Key.LeftControl,
Key.V
);

// wait for the clipboard to be updated
await new Promise((resolve) => setTimeout(resolve, 200));
Expand Down
14 changes: 6 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import * as path from "path";
import * as domains from "./domains";
import { changeSettings, initSettings } from "./settings";
import { openWebURL } from "./shared/utils/open-website";
import settings from "./settings";
import { ShortcutsSettings } from "./settings/settings.types";

Expand Down Expand Up @@ -90,7 +89,9 @@ app.whenReady().then(() => {

let tray: Tray;
app.whenReady().then(() => {
app.dock.hide();
if (process.platform === "darwin") {
app.dock.hide();
}

const icon = nativeImage.createFromPath(
path.join(__dirname, "../src/assets/tray-icon.png")
Expand Down Expand Up @@ -184,11 +185,6 @@ app.whenReady().then(() => {
},
},
{ label: "Separator", type: "separator" },
{
label: "FAQ",
role: "window",
click: () => openWebURL("https://google.com"),
},
{ label: "Quit", role: "quit", click: () => app.quit() },
]);
tray.setContextMenu(contextMenu);
Expand All @@ -205,5 +201,7 @@ export const relaunchApp = () => {
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on("window-all-closed", () => {
app.dock.hide();
if (process.platform !== "darwin") {
app.quit();
}
});
5 changes: 3 additions & 2 deletions src/services/spell-checker/spell-checker.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import axios from "axios";
import ErrorsHandler from "../../errors/errors.module";
import { axiosInstance } from "../../shared/axios";
import * as spellCheckerTypes from "./spell-checker.types";
Expand Down Expand Up @@ -29,8 +28,10 @@ export class SpellCheckerService {
}

const typeErrors = response.elements[0].errors;
type errorType =
spellCheckerTypes.SpellCheckerResponse["elements"][0]["errors"][0];

typeErrors.forEach((el) => {
typeErrors.forEach((el: errorType) => {
text = text.replace(el.word, el.suggestions[0]);
});

Expand Down

0 comments on commit bbb6c88

Please sign in to comment.