@bobfrankston/rmfmail 1.2.2 → 1.2.4

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.
@@ -964,7 +964,13 @@ function showPreviewBodyMenu(absX, absY, selectedText, sourceWindow, linkUrl, li
964
964
  return "";
965
965
  }
966
966
  })();
967
- items.push({ label: "Open link in browser", action: () => window.open(linkUrl, "_blank", "noopener,noreferrer") }, { label: guessName ? `Save link as "${guessName}"\u2026` : "Save link as\u2026", action: () => {
967
+ items.push({ label: "Open link in browser", action: () => {
968
+ const api = window.mailxapi;
969
+ if (api?.openExternal)
970
+ api.openExternal(linkUrl);
971
+ else
972
+ window.open(linkUrl, "_blank", "noopener,noreferrer");
973
+ } }, { label: guessName ? `Save link as "${guessName}"\u2026` : "Save link as\u2026", action: () => {
968
974
  const a = document.createElement("a");
969
975
  a.href = linkUrl;
970
976
  a.download = guessName || "";
@@ -1055,7 +1061,11 @@ function showPreviewBodyMenu(absX, absY, selectedText, sourceWindow, linkUrl, li
1055
1061
  action: () => {
1056
1062
  const text = (selectedText || fullBody()).slice(0, 4500);
1057
1063
  const url = `https://translate.google.com/?sl=auto&tl=en&op=translate&text=${encodeURIComponent(text)}`;
1058
- window.open(url, "_blank", "noopener,noreferrer");
1064
+ const api = window.mailxapi;
1065
+ if (api?.openExternal)
1066
+ api.openExternal(url);
1067
+ else
1068
+ window.open(url, "_blank", "noopener,noreferrer");
1059
1069
  }
1060
1070
  },
1061
1071
  { label: "", action: () => {
@@ -8889,19 +8899,15 @@ window.addEventListener("message", (e) => {
8889
8899
  return;
8890
8900
  }
8891
8901
  if (e.data?.type === "openLink" && e.data.url) {
8892
- window.open(e.data.url, "_blank", "noopener,noreferrer");
8902
+ const api = window.mailxapi;
8903
+ if (api?.openExternal) api.openExternal(e.data.url);
8904
+ else window.open(e.data.url, "_blank", "noopener,noreferrer");
8893
8905
  }
8894
8906
  if (e.data?.type === "linkClick" && e.data.url) {
8895
8907
  const url = e.data.url;
8896
- if (window.mailxapi?.platform === "android") {
8897
- const f = document.createElement("iframe");
8898
- f.style.display = "none";
8899
- f.src = `mailxapi://openurl?url=${encodeURIComponent(url)}`;
8900
- document.body.appendChild(f);
8901
- setTimeout(() => f.remove(), 500);
8902
- } else {
8903
- window.open(url, "_blank", "noopener,noreferrer");
8904
- }
8908
+ const api = window.mailxapi;
8909
+ if (api?.openExternal) api.openExternal(url);
8910
+ else window.open(url, "_blank", "noopener,noreferrer");
8905
8911
  }
8906
8912
  if (e.data?.type === "previewToggleFullscreen") {
8907
8913
  toggleFullscreenPreview();