@bobfrankston/rmfmail 1.2.220 → 1.2.221

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/bin/mailx.ts CHANGED
@@ -2791,10 +2791,21 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2791
2791
  // and emits this when Word writes; compose.ts listens and reloads Quill.
2792
2792
  imapManager.on("wordEditUpdated", (payload: { editId: string; html: string }) => {
2793
2793
  handle.send({ _event: "wordEditUpdated", type: "wordEditUpdated", ...payload });
2794
- // Bring compose back to the front after a Word save — the service's
2795
- // old mailx-host focusMainWindow call was a silent no-op (the helper
2796
- // never existed); this native msger command is the real mechanism.
2797
- handle.send({ _msgerWindow: "focus" });
2794
+ // Deliberately NO { _msgerWindow: "focus" } here. The autosave sidecar
2795
+ // saves every ~2s while the user types, and each save lands in this
2796
+ // handler so this line pulled the foreground off Word mid-sentence,
2797
+ // every couple of seconds, for the whole editing session (Bob
2798
+ // 2026-08-06: "keeps flipping back to rmfmail on any change"). The
2799
+ // focus now happens once, on wordEditClosed, below.
2800
+ });
2801
+ // Word (or the document) closed — the external edit is over. THIS is the
2802
+ // moment to bring rmfmail forward, replacing the old per-save focus grab.
2803
+ imapManager.on("wordEditClosed", (payload: { editId: string; fromPopout?: boolean }) => {
2804
+ handle.send({ _event: "wordEditClosed", type: "wordEditClosed", ...payload });
2805
+ // Only raise the MAIN window when the compose lives IN it. A popout
2806
+ // compose is a separate window with no service channel, so focusing
2807
+ // main would just cover it up.
2808
+ if (!payload.fromPopout) handle.send({ _msgerWindow: "focus" });
2798
2809
  });
2799
2810
  // Cloud-write/read failures from mailx-settings → push to UI as a banner so
2800
2811
  // silent fall-back-to-local can no longer swallow Drive errors.
@@ -614,8 +614,8 @@ function readConfigHelp(name) {
614
614
  function unsubscribeOneClick(url) {
615
615
  return ipc().unsubscribeOneClick?.(url);
616
616
  }
617
- function openInWord(editId, html) {
618
- return ipc().openInWord?.(editId, html) ?? Promise.resolve({ ok: false, path: "", opener: "none" });
617
+ function openInWord(editId, html, fromPopout = false) {
618
+ return ipc().openInWord?.(editId, html, fromPopout) ?? Promise.resolve({ ok: false, path: "", opener: "none" });
619
619
  }
620
620
  function closeWordEdit(editId) {
621
621
  return ipc().closeWordEdit?.(editId) ?? Promise.resolve();