@bobfrankston/rmfmail 1.1.201 → 1.1.203

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
@@ -3325,9 +3325,17 @@ document.addEventListener("keydown", (e) => {
3325
3325
  e.preventDefault();
3326
3326
  deleteSelection();
3327
3327
  }
3328
- // Ctrl+Z = pop the top of the undo stack (delete / move / flag).
3328
+ // Ctrl+Z = pop the top of the undo stack (delete / move / flag). Guard the
3329
+ // SAME way Delete does (the block above): never hijack Ctrl+Z when focus is
3330
+ // in a text field / contenteditable, and never while a compose overlay is
3331
+ // open — the editor (or the input) owns undo there. Without this guard the
3332
+ // mail-action undo could fire instead of an editor/text undo.
3329
3333
  if (e.ctrlKey && e.key === "z") {
3330
- if (undoStack.length > 0) {
3334
+ const t = e.target;
3335
+ const tag = t?.tagName;
3336
+ const inEditable = tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || !!t?.isContentEditable;
3337
+ const composeOpen = !!document.querySelector(".compose-overlay");
3338
+ if (!inEditable && !composeOpen && undoStack.length > 0) {
3331
3339
  e.preventDefault();
3332
3340
  performUndo();
3333
3341
  }