@bobfrankston/rmfmail 1.2.233 → 1.2.235

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.
@@ -6607,9 +6607,17 @@ var extEditHintClose = null;
6607
6607
  if (btn) btn.style.display = "none";
6608
6608
  }
6609
6609
  }
6610
+ var wordEditOpening = false;
6610
6611
  document.getElementById("btn-edit-in-word")?.addEventListener("click", async () => {
6612
+ const btn = document.getElementById("btn-edit-in-word");
6613
+ if (wordEditOpening) return;
6614
+ wordEditOpening = true;
6615
+ if (btn) {
6616
+ btn.disabled = true;
6617
+ btn.style.opacity = "0.6";
6618
+ }
6611
6619
  if (!wordEditId) wordEditId = `compose-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
6612
- showDraftStatus("Opening in Word\u2026", false);
6620
+ showDraftStatus("Opening in Word\u2026 (this takes a few seconds)", false);
6613
6621
  try {
6614
6622
  const result = await openInWord(wordEditId, editor.getHtml(), !!popoutInitId);
6615
6623
  if (!result.ok || result.opener === "none") {
@@ -6618,10 +6626,22 @@ document.getElementById("btn-edit-in-word")?.addEventListener("click", async ()
6618
6626
  }
6619
6627
  const label = result.opener === "word" ? "Word" : result.opener === "libreoffice" ? "LibreOffice" : "your default editor";
6620
6628
  const isDocx = /\.docx$/i.test(result.path || "");
6621
- showDraftStatus(`Editing in ${label} \u2014 Ctrl+S there and the message updates here automatically.`, false);
6622
- if (!isDocx) showExternalEditHint(label);
6629
+ if (result.reused) {
6630
+ showDraftStatus(`Already open in ${label} \u2014 brought that window to the front.`, false);
6631
+ } else if (result.superseded) {
6632
+ showDraftStatus(`Opened an updated copy in ${label}. Close the earlier ${label} window \u2014 changes made there no longer come back.`, true);
6633
+ } else {
6634
+ showDraftStatus(`Editing in ${label} \u2014 Ctrl+S there and the message updates here automatically.`, false);
6635
+ if (!isDocx) showExternalEditHint(label);
6636
+ }
6623
6637
  } catch (e) {
6624
6638
  showDraftStatus(`Edit-in-Word failed: ${e?.message || e}`, true);
6639
+ } finally {
6640
+ wordEditOpening = false;
6641
+ if (btn) {
6642
+ btn.disabled = false;
6643
+ btn.style.opacity = "";
6644
+ }
6625
6645
  }
6626
6646
  });
6627
6647
  document.getElementById("btn-compose-help")?.addEventListener("click", async () => {