@bobfrankston/rmfmail 1.1.106 → 1.1.108

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.
@@ -21,6 +21,7 @@ __export(api_client_exports, {
21
21
  allowRemoteContent: () => allowRemoteContent,
22
22
  autocomplete: () => autocomplete,
23
23
  cancelQueuedOutgoing: () => cancelQueuedOutgoing,
24
+ cancelServerSearch: () => cancelServerSearch,
24
25
  closeWordEdit: () => closeWordEdit,
25
26
  connectEvents: () => connectEvents,
26
27
  connectWebSocket: () => connectWebSocket,
@@ -194,6 +195,9 @@ function getUnifiedInbox(page = 1, pageSize = 50) {
194
195
  function searchMessages(query, page = 1, pageSize = 50, scope = "all", accountId = "", folderId = 0, includeTrashSpam = false) {
195
196
  return ipc().searchMessages(query, page, pageSize, scope, accountId, folderId, includeTrashSpam);
196
197
  }
198
+ function cancelServerSearch() {
199
+ return ipc().cancelServerSearch?.();
200
+ }
197
201
  function getMessage(accountId, uid, allowRemote = false, folderId) {
198
202
  return ipc().getMessage(accountId, uid, allowRemote, folderId);
199
203
  }
@@ -7418,14 +7422,14 @@ function quoteBody(msg) {
7418
7422
  const date = new Date(msg.date).toLocaleString();
7419
7423
  const from = msg.from.name ? `${msg.from.name} <${msg.from.address}>` : msg.from.address;
7420
7424
  const body = sanitizeQuotedBody(msg);
7421
- return `<br><br><div class="reply"><p>On ${date}, ${from} wrote:</p><blockquote>${body}</blockquote></div>`;
7425
+ return `<p></p><br><br><div class="reply"><p>On ${date}, ${from} wrote:</p><blockquote>${body}</blockquote></div>`;
7422
7426
  }
7423
7427
  function forwardBody(msg) {
7424
7428
  const date = new Date(msg.date).toLocaleString();
7425
7429
  const from = msg.from.name ? `${msg.from.name} &lt;${msg.from.address}&gt;` : msg.from.address;
7426
7430
  const to = msg.to.map((a) => a.name ? `${a.name} &lt;${a.address}&gt;` : a.address).join(", ");
7427
7431
  const body = sanitizeQuotedBody(msg);
7428
- return `<br><br><div class="reply"><p>---------- Forwarded message ----------<br>From: ${from}<br>Date: ${date}<br>Subject: ${msg.subject}<br>To: ${to}</p>${body}</div>`;
7432
+ return `<p></p><br><br><div class="reply"><p>---------- Forwarded message ----------<br>From: ${from}<br>Date: ${date}<br>Subject: ${msg.subject}<br>To: ${to}</p>${body}</div>`;
7429
7433
  }
7430
7434
  var lastDeleted = null;
7431
7435
  var lastMoved = null;
@@ -7944,6 +7948,8 @@ searchInput?.addEventListener("scroll", () => {
7944
7948
  });
7945
7949
  searchInput?.addEventListener("change", () => updateSearchHighlight());
7946
7950
  updateSearchHighlight();
7951
+ var SERVER_SEARCH_DALLY_MS = 700;
7952
+ var serverSearchTimer = null;
7947
7953
  function doSearch(immediate = false) {
7948
7954
  const query = searchInput.value.trim();
7949
7955
  if (query.length === 0) {
@@ -7954,9 +7960,14 @@ function doSearch(immediate = false) {
7954
7960
  const serverCheck = document.getElementById("search-server-too");
7955
7961
  const trashCheck = document.getElementById("search-include-trash");
7956
7962
  const localScope = searchScope?.value || "all";
7957
- const effectiveScope = serverCheck?.checked ? "server" : localScope;
7958
7963
  const includeTrash = !!trashCheck?.checked;
7959
- if (effectiveScope === "current" && !immediate) {
7964
+ const serverOn = !!serverCheck?.checked;
7965
+ if (serverSearchTimer) {
7966
+ clearTimeout(serverSearchTimer);
7967
+ serverSearchTimer = null;
7968
+ }
7969
+ cancelServerSearch();
7970
+ if (localScope === "current" && !serverOn && !immediate) {
7960
7971
  const body = document.getElementById("ml-body");
7961
7972
  if (body) {
7962
7973
  const lower = query.toLowerCase();
@@ -7967,19 +7978,31 @@ function doSearch(immediate = false) {
7967
7978
  }
7968
7979
  return;
7969
7980
  }
7970
- loadSearchResults(query, effectiveScope, currentAccountId3, currentFolderId2, includeTrash);
7981
+ const localScopeEff = localScope === "current" ? "current" : "all";
7982
+ loadSearchResults(query, localScopeEff, currentAccountId3, currentFolderId2, includeTrash);
7971
7983
  setTitle(`${APP_NAME} - Search: ${query}`);
7972
7984
  setActiveView(
7973
- { kind: "search", query, scope: effectiveScope, accountId: currentAccountId3, folderId: currentFolderId2, includeTrash },
7985
+ { kind: "search", query, scope: serverOn ? "server" : localScopeEff, accountId: currentAccountId3, folderId: currentFolderId2, includeTrash },
7974
7986
  `Search: ${query}`
7975
7987
  );
7976
7988
  recordSearchHistory(query);
7989
+ if (serverOn) {
7990
+ serverSearchTimer = setTimeout(() => {
7991
+ serverSearchTimer = null;
7992
+ loadSearchResults(query, "server", currentAccountId3, currentFolderId2, includeTrash);
7993
+ }, SERVER_SEARCH_DALLY_MS);
7994
+ }
7977
7995
  }
7978
7996
  var currentAccountId3 = "";
7979
7997
  var currentFolderId2 = 0;
7980
7998
  var reloadDebounceTimer = null;
7981
7999
  searchInput?.addEventListener("input", () => {
7982
8000
  clearTimeout(searchTimeout);
8001
+ if (serverSearchTimer) {
8002
+ clearTimeout(serverSearchTimer);
8003
+ serverSearchTimer = null;
8004
+ cancelServerSearch();
8005
+ }
7983
8006
  updateSearchHighlight();
7984
8007
  if (searchInput.value.trim() === "") {
7985
8008
  clearSearchMode();
@@ -7988,7 +8011,7 @@ searchInput?.addEventListener("input", () => {
7988
8011
  reloadCurrentFolder();
7989
8012
  setTitle(APP_NAME);
7990
8013
  } else {
7991
- searchTimeout = setTimeout(() => doSearch(false), 300);
8014
+ searchTimeout = setTimeout(() => doSearch(false), 180);
7992
8015
  }
7993
8016
  });
7994
8017
  searchInput?.addEventListener("keydown", (e) => {
@@ -7998,6 +8021,11 @@ searchInput?.addEventListener("keydown", (e) => {
7998
8021
  }
7999
8022
  if (e.key === "Escape") {
8000
8023
  searchInput.value = "";
8024
+ if (serverSearchTimer) {
8025
+ clearTimeout(serverSearchTimer);
8026
+ serverSearchTimer = null;
8027
+ }
8028
+ cancelServerSearch();
8001
8029
  updateSearchHighlight();
8002
8030
  clearSearchMode();
8003
8031
  const body = document.getElementById("ml-body");
@@ -9848,6 +9876,10 @@ getSettings().then((s) => {
9848
9876
  }).catch(() => {
9849
9877
  });
9850
9878
  function saveEditorSetting(editor) {
9879
+ try {
9880
+ localStorage.setItem("mailx-editor-type", editor);
9881
+ } catch {
9882
+ }
9851
9883
  getSettings().then((settings) => {
9852
9884
  settings.ui = { ...settings.ui, editor };
9853
9885
  saveSettings(settings);