@bobfrankston/rmfmail 1.2.81 → 1.2.83

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.
@@ -2418,6 +2418,7 @@ function popOutToWindow() {
2418
2418
  return;
2419
2419
  const p = window.__rmfPopout;
2420
2420
  if (!p?.base || !p?.token) {
2421
+ console.log("[popout-window] no server info (__rmfPopout missing) \u2192 overlay fallback");
2421
2422
  popOutCurrentMessage();
2422
2423
  return;
2423
2424
  }
@@ -2425,9 +2426,28 @@ function popOutToWindow() {
2425
2426
  const u = currentMessage.uid;
2426
2427
  const f = currentMessage.folderId;
2427
2428
  const url = `${p.base}/v?a=${encodeURIComponent(a)}&u=${u}&f=${f ?? ""}&t=${encodeURIComponent(p.token)}`;
2428
- const w = window.open(url, `rmfmsg-${a}-${u}`, "width=820,height=900,resizable=yes,scrollbars=yes");
2429
- if (!w)
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");
2430
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);
2431
2451
  }
2432
2452
  function printCurrentMessage() {
2433
2453
  if (!currentMessage)
@@ -2551,22 +2571,26 @@ function spawnDesktopPopout(msg, accountId) {
2551
2571
  wrapper.style.right = `${20 + existing * 28}px`;
2552
2572
  }
2553
2573
  const toolbar = document.createElement("div");
2554
- toolbar.style.cssText = "display:flex;gap:6px;padding:6px 12px;border-bottom:1px solid var(--color-border, #ddd);flex-shrink:0;";
2555
- const mkPopoutBtn = (label, title, onClick) => {
2574
+ toolbar.className = "mv-toolbar";
2575
+ toolbar.style.cssText = "display:flex;gap:4px;padding:6px 12px;border-bottom:1px solid var(--color-border, #ddd);flex-shrink:0;";
2576
+ const mkPopoutBtn = (glyph, title, onClick) => {
2556
2577
  const b = document.createElement("button");
2557
- b.textContent = label;
2578
+ b.className = "tb-btn";
2579
+ b.textContent = glyph;
2558
2580
  b.title = title;
2559
- b.style.cssText = "padding:4px 10px;font-size:13px;cursor:pointer;border:1px solid var(--color-border, #ccc);border-radius:4px;background:var(--color-bg, #fff);color:var(--color-text, #000);";
2581
+ b.style.cssText = "padding:4px 9px;font-size:15px;cursor:pointer;border:1px solid var(--color-border, #ccc);border-radius:4px;background:var(--color-bg, #fff);color:var(--color-text, #000);";
2560
2582
  b.addEventListener("click", onClick);
2561
2583
  return b;
2562
2584
  };
2563
2585
  const firePopoutAction = (action) => {
2564
2586
  document.dispatchEvent(new CustomEvent("mailx-popout-action", { detail: { action, msg, accountId } }));
2565
2587
  };
2566
- toolbar.appendChild(mkPopoutBtn("Reply", "Reply", () => firePopoutAction("reply")));
2567
- toolbar.appendChild(mkPopoutBtn("Reply All", "Reply to all", () => firePopoutAction("replyAll")));
2568
- toolbar.appendChild(mkPopoutBtn("Forward", "Forward", () => firePopoutAction("forward")));
2569
- toolbar.appendChild(mkPopoutBtn("Delete", "Delete this message", () => {
2588
+ toolbar.appendChild(mkPopoutBtn("\u21A9", "Reply (Ctrl+R)", () => firePopoutAction("reply")));
2589
+ toolbar.appendChild(mkPopoutBtn("\u21A9\u21A9", "Reply All (Ctrl+Shift+R)", () => firePopoutAction("replyAll")));
2590
+ toolbar.appendChild(mkPopoutBtn("\u2192", "Forward", () => firePopoutAction("forward")));
2591
+ toolbar.appendChild(mkPopoutBtn("\u29C9", "Edit as new message", () => firePopoutAction("editAsNew")));
2592
+ toolbar.appendChild(mkPopoutBtn("\u2605", "Flag", () => firePopoutAction("flag")));
2593
+ toolbar.appendChild(mkPopoutBtn("\u{1F5D1}", "Delete", () => {
2570
2594
  firePopoutAction("delete");
2571
2595
  wrapper.remove();
2572
2596
  }));
@@ -11572,10 +11596,15 @@ ${detail}`;
11572
11596
  document.addEventListener("mailx-popout-action", ((e) => {
11573
11597
  const { action, msg, accountId } = e.detail || {};
11574
11598
  if (!msg) return;
11575
- if (action === "reply" || action === "replyAll" || action === "forward") {
11599
+ if (action === "reply" || action === "replyAll" || action === "forward" || action === "editAsNew") {
11576
11600
  openCompose(action, msg, accountId);
11577
11601
  } else if (action === "delete") {
11578
11602
  deleteMessage(accountId, msg.uid).catch((err) => console.error(`[popout] delete failed: ${err?.message || err}`));
11603
+ } else if (action === "flag") {
11604
+ const wasFlagged = flaggedOf(msg);
11605
+ setFlagged(msg, !wasFlagged);
11606
+ updateFlags(accountId, msg.uid, msg.flags, msg.folderId).catch((err) => console.error(`[popout] flag failed: ${err?.message || err}`));
11607
+ setRowFlagged(accountId, msg.uid, !wasFlagged);
11579
11608
  }
11580
11609
  }));
11581
11610
  document.addEventListener("mailx-popout-message", (async (e) => {