@bobfrankston/rmfmail 1.2.82 → 1.2.84

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.
@@ -2413,6 +2413,42 @@ function popOutCurrentMessage() {
2413
2413
  }
2414
2414
  spawnDesktopPopout(currentMessage, currentAccountId);
2415
2415
  }
2416
+ function popOutToWindow() {
2417
+ if (!currentMessage)
2418
+ return;
2419
+ const p = window.__rmfPopout;
2420
+ if (!p?.base || !p?.token) {
2421
+ console.log("[popout-window] no server info (__rmfPopout missing) \u2192 overlay fallback");
2422
+ popOutCurrentMessage();
2423
+ return;
2424
+ }
2425
+ const a = currentAccountId;
2426
+ const u = currentMessage.uid;
2427
+ const f = currentMessage.folderId;
2428
+ const url = `${p.base}/v?a=${encodeURIComponent(a)}&u=${u}&f=${f ?? ""}&t=${encodeURIComponent(p.token)}`;
2429
+ console.log(`[popout-window] opening ${url}`);
2430
+ let w = null;
2431
+ try {
2432
+ w = window.open(url, `rmfmsg-${a}-${u}`, "width=820,height=900,resizable=yes,scrollbars=yes");
2433
+ } catch (e) {
2434
+ console.log(`[popout-window] window.open THREW: ${e?.message || e} \u2192 overlay fallback`);
2435
+ popOutCurrentMessage();
2436
+ return;
2437
+ }
2438
+ if (!w) {
2439
+ console.log("[popout-window] window.open returned NULL (host blocked it) \u2192 overlay fallback");
2440
+ popOutCurrentMessage();
2441
+ return;
2442
+ }
2443
+ console.log("[popout-window] window.open returned a window object; verifying it stays open\u2026");
2444
+ setTimeout(() => {
2445
+ try {
2446
+ console.log(`[popout-window] +600ms: window.closed=${w.closed}`);
2447
+ } catch (e) {
2448
+ console.log(`[popout-window] +600ms: cannot read .closed (${e?.message || e})`);
2449
+ }
2450
+ }, 600);
2451
+ }
2416
2452
  function printCurrentMessage() {
2417
2453
  if (!currentMessage)
2418
2454
  return;
@@ -7888,6 +7924,7 @@ var backToList = (e) => {
7888
7924
  document.getElementById("btn-back")?.addEventListener("click", backToList);
7889
7925
  document.getElementById("btn-back")?.addEventListener("touchend", backToList);
7890
7926
  document.getElementById("mv-popout")?.addEventListener("click", () => popOutCurrentMessage());
7927
+ document.getElementById("mv-popout-window")?.addEventListener("click", () => popOutToWindow());
7891
7928
  document.getElementById("btn-print")?.addEventListener("click", () => printCurrentMessage());
7892
7929
  document.getElementById("folder-tree")?.addEventListener("click", (e) => {
7893
7930
  if (window.innerWidth <= 768 && e.target.closest(".ft-folder")) {
@@ -8143,6 +8180,9 @@ async function openCompose(mode, overrideMsg, overrideAccountId) {
8143
8180
  init.cc = Array.isArray(msg.cc) ? msg.cc : [];
8144
8181
  init.subject = msg.subject || "";
8145
8182
  init.bodyHtml = editAsNewBody(msg);
8183
+ const origFrom = msg.from?.address ? bareAddress(msg.from.address) : "";
8184
+ const ownFrom = origFrom && accounts.some((acc) => bareAddress(acc.email || "") === origFrom) ? origFrom : void 0;
8185
+ init.fromAddress = ownFrom || detectReplyFrom();
8146
8186
  }
8147
8187
  if (msg && (mode === "editAsNew" || mode === "forward") && Array.isArray(msg.attachments) && msg.attachments.length) {
8148
8188
  const msgAccountId = current?.accountId || accountId;