@bobfrankston/rmfmail 1.1.67 → 1.1.68

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
@@ -3716,7 +3716,7 @@ document.getElementById("btn-open-log")?.addEventListener("click", async () => {
3716
3716
  }
3717
3717
  });
3718
3718
  async function openJsoncEditor(initialFile) {
3719
- const { readJsoncFile, writeJsoncFile, readConfigHelp, formatJsonc } = await import("./lib/api-client.js");
3719
+ const { readJsoncFile, writeJsoncFile, readConfigHelp, formatJsonc, openLocalPath } = await import("./lib/api-client.js");
3720
3720
  const backdrop = document.createElement("div");
3721
3721
  backdrop.className = "mailx-modal-backdrop";
3722
3722
  const panel = document.createElement("div");
@@ -3752,6 +3752,7 @@ async function openJsoncEditor(initialFile) {
3752
3752
  <div class="mailx-modal-error" id="jsonc-error" hidden></div>
3753
3753
  <div class="mailx-modal-buttons">
3754
3754
  <button type="button" class="mailx-modal-btn" data-action="format" title="Reformat indentation while preserving comments and trailing commas">Format</button>
3755
+ <button type="button" class="mailx-modal-btn" data-action="opensource" id="jsonc-opensource" title="Open the folder containing config.jsonc so you can edit it in a full editor" hidden>Open source folder</button>
3755
3756
  <span class="mailx-modal-spacer"></span>
3756
3757
  <button type="button" class="mailx-modal-btn" data-action="cancel">Cancel</button>
3757
3758
  <button type="button" class="mailx-modal-btn mailx-modal-btn-primary" data-action="save">Save</button>
@@ -3869,8 +3870,16 @@ async function openJsoncEditor(initialFile) {
3869
3870
  errorEl.hidden = false;
3870
3871
  }
3871
3872
  };
3873
+ // "Open source folder" — only meaningful for config.jsonc, the one
3874
+ // file that lives on the local disk (~/.rmfmail/config.jsonc). The
3875
+ // others are Google Drive objects with no local path, so the button
3876
+ // is hidden for them. Lets the user edit config.jsonc in a real editor
3877
+ // instead of the modal textarea.
3878
+ const openSourceBtn = panel.querySelector("#jsonc-opensource");
3879
+ const updateOpenSource = () => { openSourceBtn.hidden = fileSelect.value !== "config.jsonc"; };
3880
+ updateOpenSource();
3872
3881
  await Promise.all([loadFile(), loadHelp()]);
3873
- fileSelect.addEventListener("change", () => { loadFile(); loadHelp(); });
3882
+ fileSelect.addEventListener("change", () => { loadFile(); loadHelp(); updateOpenSource(); });
3874
3883
  const close = () => {
3875
3884
  if (validateTimer)
3876
3885
  window.clearTimeout(validateTimer);
@@ -3893,6 +3902,18 @@ async function openJsoncEditor(initialFile) {
3893
3902
  close();
3894
3903
  return;
3895
3904
  }
3905
+ if (action === "opensource") {
3906
+ // Reveal ~/.rmfmail/ in the OS file manager — config.jsonc
3907
+ // sits there; the user can then open it in a full editor.
3908
+ try {
3909
+ await openLocalPath("config");
3910
+ }
3911
+ catch (e) {
3912
+ errorEl.textContent = `Couldn't open folder: ${e?.message || e}`;
3913
+ errorEl.hidden = false;
3914
+ }
3915
+ return;
3916
+ }
3896
3917
  if (action === "format") {
3897
3918
  // Reformat via the service-side jsonc-parser format() — the
3898
3919
  // edits are whitespace-only, so `//` and `/* */` comments