@bobfrankston/rmfmail 1.0.535 → 1.0.537

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/app.js CHANGED
@@ -2209,28 +2209,33 @@ onWsEvent((event) => {
2209
2209
  });
2210
2210
  // ── Keyboard shortcuts ──
2211
2211
  // Capture-phase pre-handler: intercept WebView accelerator keys that would
2212
- // otherwise trigger a browser action (Ctrl+R / Ctrl+Shift+R / F5 = reload,
2213
- // Ctrl+P = print, etc.) before the document-level handler runs. Without
2214
- // this the browser eats the keystroke. Whether preventDefault actually
2215
- // suppresses the WebView's reload depends on WebView2's
2216
- // AreBrowserAcceleratorKeysEnabled setting; if it doesn't, we'll need
2217
- // the msger Rust side to disable that flag and we can also bind a
2218
- // replacement reload key here.
2212
+ // otherwise trigger a browser action (Ctrl+R / Ctrl+Shift+R = reload). Call
2213
+ // the action directly here earlier version re-dispatched a synthetic
2214
+ // keydown to document, which bubbled back up to this window listener and
2215
+ // fired again, breaking unrelated shortcuts (user-reported: Ctrl+N
2216
+ // stopped composing). Direct dispatch avoids the recursion.
2217
+ //
2218
+ // Whether preventDefault actually suppresses WebView2's native reload
2219
+ // depends on AreBrowserAcceleratorKeysEnabled — if it still reloads,
2220
+ // the msger Rust side needs the flag flipped (option 1 in the original
2221
+ // design notes).
2219
2222
  window.addEventListener("keydown", (e) => {
2220
- // Ctrl+Shift+R = Reply All. Ctrl+R alone = Reply (also stomps WebView reload).
2221
- // Both routed through the document handler below; we just ensure the
2222
- // browser doesn't reload.
2223
- if (e.ctrlKey && (e.key === "r" || e.key === "R") && !e.altKey && !e.metaKey) {
2224
- e.preventDefault();
2225
- e.stopImmediatePropagation();
2226
- // Re-dispatch as a document-level event so the existing handler runs
2227
- // (it's bound to `document` not `window`, and stopImmediatePropagation
2228
- // would prevent it from firing naturally on this same event).
2229
- document.dispatchEvent(new KeyboardEvent("keydown", {
2230
- key: e.key, code: e.code, ctrlKey: e.ctrlKey, shiftKey: e.shiftKey,
2231
- altKey: e.altKey, metaKey: e.metaKey, bubbles: true, cancelable: true,
2232
- }));
2233
- }
2223
+ if (!e.ctrlKey || e.altKey || e.metaKey)
2224
+ return;
2225
+ if (e.key !== "r" && e.key !== "R")
2226
+ return;
2227
+ // Skip when the user is typing in an input (compose textarea etc.) so
2228
+ // we don't hijack their typing to fire reply-all.
2229
+ const t = e.target;
2230
+ const tag = t?.tagName;
2231
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || t?.isContentEditable)
2232
+ return;
2233
+ e.preventDefault();
2234
+ e.stopImmediatePropagation();
2235
+ if (e.shiftKey)
2236
+ openCompose("replyAll");
2237
+ else
2238
+ openCompose("reply");
2234
2239
  }, { capture: true });
2235
2240
  document.addEventListener("keydown", (e) => {
2236
2241
  // Ctrl+N or Ctrl+Shift+M = Compose