@bobfrankston/rmfmail 1.0.543 → 1.0.545

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
@@ -2769,6 +2769,44 @@ optSnippet?.addEventListener("change", () => {
2769
2769
  }
2770
2770
  localStorage.setItem("mailx-snippet", String(optSnippet.checked));
2771
2771
  });
2772
+ // ── Search help button (?) ──
2773
+ // Opens a small modal showing docs/search.md so the user can see the
2774
+ // query syntax for each mode (FTS5 vs IMAP SEARCH vs Gmail API). The
2775
+ // markdown is fetched from the service via readConfigHelp("search"),
2776
+ // rendered as plain text inside a <pre> — no full markdown engine, just
2777
+ // preserves headings + tables visually. The doc itself is the source of
2778
+ // truth (lives at app/docs/search.md, deployed to GDrive on every
2779
+ // release like the other config help files).
2780
+ document.getElementById("search-help")?.addEventListener("click", async () => {
2781
+ const { readConfigHelp } = await import("./lib/api-client.js");
2782
+ const r = await readConfigHelp("search").catch(() => ({ content: "" }));
2783
+ const md = r?.content || "";
2784
+ const backdrop = document.createElement("div");
2785
+ backdrop.className = "mailx-modal-backdrop";
2786
+ backdrop.style.cssText = "position:fixed;inset:0;z-index:2000;background:rgba(0,0,0,0.4);display:flex;align-items:center;justify-content:center;";
2787
+ const panel = document.createElement("div");
2788
+ panel.style.cssText = "background:var(--color-bg,#fff);color:var(--color-text,#000);border-radius:8px;box-shadow:0 8px 32px rgba(0,0,0,0.3);width:min(820px,92vw);max-height:85vh;display:flex;flex-direction:column;";
2789
+ panel.innerHTML = `
2790
+ <div style="padding:14px 18px;border-bottom:1px solid var(--color-border,#ddd);display:flex;justify-content:space-between;align-items:center">
2791
+ <span style="font-weight:600">Search syntax</span>
2792
+ <button type="button" id="search-help-close" style="background:none;border:0;font-size:18px;cursor:pointer">&times;</button>
2793
+ </div>
2794
+ <pre style="margin:0;padding:14px 18px;overflow:auto;font:13px/1.5 var(--font-ui);white-space:pre-wrap;word-wrap:break-word">${(md || "Help not available — check that docs/search.md is deployed.")
2795
+ .replace(/[&<>]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" }[c] || c))}</pre>
2796
+ `;
2797
+ backdrop.appendChild(panel);
2798
+ document.body.appendChild(backdrop);
2799
+ const close = () => backdrop.remove();
2800
+ panel.querySelector("#search-help-close")?.addEventListener("click", close);
2801
+ backdrop.addEventListener("click", e => { if (e.target === backdrop)
2802
+ close(); });
2803
+ document.addEventListener("keydown", function escClose(e) {
2804
+ if (e.key === "Escape") {
2805
+ close();
2806
+ document.removeEventListener("keydown", escClose);
2807
+ }
2808
+ });
2809
+ });
2772
2810
  // ── JSONC config file editor ──
2773
2811
  document.getElementById("btn-edit-jsonc")?.addEventListener("click", async () => {
2774
2812
  const settingsDropdown = document.getElementById("settings-dropdown");