Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix(chrome-ext): filter out erroneous double-clicking (#1653)

Elijah Potter5ee6e937fdfe
diff --git a/packages/chrome-plugin/src/Highlights.ts b/packages/chrome-plugin/src/Highlights.ts
index 48143a99f..340e23b42 100644
--- a/packages/chrome-plugin/src/Highlights.ts
+++ b/packages/chrome-plugin/src/Highlights.ts
@@ -1,7 +1,6 @@
-import { render } from 'svelte/server';
import type { VNode } from 'virtual-dom';
import h from 'virtual-dom/h';
-import { isBoxInScreen, type LintBox } from './Box';
+import type { LintBox } from './Box';
import {
getCMRoot,
getDraftRoot,
diff --git a/packages/chrome-plugin/src/PopupHandler.ts b/packages/chrome-plugin/src/PopupHandler.ts
index 5b1275139..5ac7484dd 100644
--- a/packages/chrome-plugin/src/PopupHandler.ts
+++ b/packages/chrome-plugin/src/PopupHandler.ts
@@ -11,7 +11,8 @@ function monitorDoubleShift(onDoubleShift: DoubleShiftHandler, interval = 300):
const handler = (e: KeyboardEvent) => {
if (e.key !== 'Shift') return;
const now = performance.now();
- if (now - lastTime <= interval) onDoubleShift();
+ const diff = now - lastTime;
+ if (diff <= interval && diff > 10) onDoubleShift();
lastTime = now;
};
window.addEventListener('keydown', handler);
diff --git a/packages/obsidian-plugin/.gitignore b/packages/obsidian-plugin/.gitignore
index 88acc764a..2be80db5a 100644
--- a/packages/obsidian-plugin/.gitignore
+++ b/packages/obsidian-plugin/.gitignore
@@ -3,3 +3,4 @@ main.js
node_modules
harper-obsidian-plugin.zip
manifest.json
+data.json