@bobfrankston/rmfmail 1.2.192 → 1.2.194

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.ts CHANGED
@@ -1755,6 +1755,16 @@ async function performUndo(): Promise<void> {
1755
1755
  if (statusSync) statusSync.textContent = msgs.length === 1
1756
1756
  ? "Message restored"
1757
1757
  : `Restored ${msgs.length} messages`;
1758
+ // Position at what was just restored — an undo whose effect lands
1759
+ // off-screen (or in a folder you've since left) reads as a no-op.
1760
+ // Reveal the first of the batch; the rest are in the same view.
1761
+ // On a miss revealMessage restores the prior view itself.
1762
+ const first = msgs[0];
1763
+ if (first?.folderId) {
1764
+ await revealMessage(first.accountId, first.folderId, first.uid);
1765
+ syncChromeToListView();
1766
+ return;
1767
+ }
1758
1768
  } else if (op.kind === "move") {
1759
1769
  const { messages } = op.payload;
1760
1770
  const byDest = new Map<string, { accountId: string; folderId: number; uids: number[] }>();
@@ -1769,6 +1779,14 @@ async function performUndo(): Promise<void> {
1769
1779
  else await moveMessages(group.accountId, group.uids, group.folderId);
1770
1780
  }
1771
1781
  if (statusSync) statusSync.textContent = `Undid move of ${messages.length} message${messages.length !== 1 ? "s" : ""}`;
1782
+ // Same positioning rule as undo-delete: show the message back in
1783
+ // its original folder.
1784
+ const firstMoved = messages[0];
1785
+ if (firstMoved?.sourceFolderId) {
1786
+ await revealMessage(firstMoved.accountId, firstMoved.sourceFolderId, firstMoved.uid);
1787
+ syncChromeToListView();
1788
+ return;
1789
+ }
1772
1790
  } else if (op.kind === "flag") {
1773
1791
  const { updateFlags } = await import("./lib/api-client.js");
1774
1792
  // Restore each row's prior \Flagged state. Mutates message-state
@@ -2644,6 +2662,14 @@ async function closeSearchAndReveal(): Promise<void> {
2644
2662
  // claimed search-on-All-Inboxes and the list looked broken (Bob
2645
2663
  // 2026-07-04 "cleared the search but it isn't restoring the list").
2646
2664
  // Sync tab, tree highlight and titles to what the list actually shows.
2665
+ syncChromeToListView();
2666
+ }
2667
+
2668
+ /** Mirror tab, folder-tree highlight and titles to whatever view the message
2669
+ * list is actually showing. Needed after any list-driven navigation
2670
+ * (revealMessage from search-close or undo) — the list module can land on a
2671
+ * different folder than the surrounding chrome still claims. */
2672
+ function syncChromeToListView(): void {
2647
2673
  const vw = getCurrentView();
2648
2674
  if (vw.unified) {
2649
2675
  highlightFolder(null, -1);
@@ -6150,8 +6150,9 @@ document.getElementById("btn-edit-in-word")?.addEventListener("click", async ()
6150
6150
  return;
6151
6151
  }
6152
6152
  const label = result.opener === "word" ? "Word" : result.opener === "libreoffice" ? "LibreOffice" : "your default editor";
6153
- showDraftStatus(`Editing in ${label} \u2014 saves there will reload here.`, false);
6154
- showExternalEditHint(label);
6153
+ const isDocx = /\.docx$/i.test(result.path || "");
6154
+ showDraftStatus(`Editing in ${label} \u2014 Ctrl+S there and the message updates here automatically.`, false);
6155
+ if (!isDocx) showExternalEditHint(label);
6155
6156
  } catch (e) {
6156
6157
  showDraftStatus(`Edit-in-Word failed: ${e?.message || e}`, true);
6157
6158
  }
@@ -6257,7 +6258,7 @@ function showExternalEditHint(editorLabel) {
6257
6258
  <div style="font-weight:600;font-size:16px;margin-bottom:10px;">Editing in ${escapeHtml(editorLabel)}</div>
6258
6259
  <ol style="margin:0 0 12px 18px;padding:0;">
6259
6260
  <li>Edit your message in <b>${escapeHtml(editorLabel)}</b>.</li>
6260
- <li>Save (<b>Ctrl+S</b>). Today, choose <b>"Web Page, Filtered (.htm)"</b> if Word asks for a format \u2014 keep the same filename.</li>
6261
+ <li>Save (<b>Ctrl+S</b>). Choose <b>"Web Page, Filtered (.htm)"</b> if asked for a format \u2014 keep the same filename.</li>
6261
6262
  <li>Switch back to this window (<b>Alt+Tab</b>). The body will reload here.</li>
6262
6263
  <li>Click <b>Send</b> in this window when ready.</li>
6263
6264
  </ol>