@bobfrankston/rmfmail 1.1.96 → 1.1.98

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.ts CHANGED
@@ -2885,8 +2885,16 @@ document.addEventListener("keydown", (e) => {
2885
2885
  }
2886
2886
  // Ctrl+A = Select all visible messages
2887
2887
  if (e.ctrlKey && e.key === "a") {
2888
+ const t = e.target as HTMLElement | null;
2889
+ const tag = t?.tagName;
2890
+ // In a text field / editor, Ctrl+A means "select the text" — never
2891
+ // hijack it to select-all-messages. The old guard's `.closest(...,
2892
+ // body)` always matched (everything is inside <body>), so Ctrl+A in
2893
+ // the search box selected every message instead of the box's text,
2894
+ // and the field couldn't be selected+cleared (Bob 2026-05-18).
2895
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || t?.isContentEditable) return;
2888
2896
  const mlBody = document.getElementById("ml-body");
2889
- if (mlBody && document.activeElement?.closest(".message-list, .ml-body, body")) {
2897
+ if (mlBody) {
2890
2898
  e.preventDefault();
2891
2899
  mlBody.querySelectorAll(".ml-row").forEach(r => r.classList.add("selected"));
2892
2900
  }
@@ -831,6 +831,10 @@ async function createTinyMceEditor(container2, opts = {}) {
831
831
  /* true = start */
832
832
  );
833
833
  editor2.focus();
834
+ if (pos === 0)
835
+ editor2.getWin()?.scrollTo(0, 0);
836
+ else
837
+ editor2.selection.scrollIntoView();
834
838
  } catch {
835
839
  }
836
840
  },
@@ -4002,14 +4006,18 @@ function applyInit(init) {
4002
4006
  (_match, attrs, inner) => `<pre${attrs}>${inner.replace(/\r\n|\r|\n/g, "<br>")}</pre>`
4003
4007
  );
4004
4008
  const acct = init.accounts.find((a) => a.id === init.accountId);
4005
- const isNew = init.mode !== "reply" && init.mode !== "replyAll" && init.mode !== "forward" && init.mode !== "draft" && !init.draftUid;
4006
4009
  const isReplyForward = init.mode === "reply" || init.mode === "replyAll" || init.mode === "forward";
4007
- if (isNew && acct?.sig?.text) {
4008
- const sigText = acct.sig.html ? acct.sig.text : escapeHtml(acct.sig.text).replace(/\n/g, "<br>");
4009
- bodyToRender = `${bodyToRender}<br><br>-- <br>${sigText}`;
4010
- } else if (acct?.signature && init.mode !== "draft" && !init.draftUid) {
4011
- const sigBlock = `<br><br>--<br>${acct.signature}`;
4012
- bodyToRender = isReplyForward ? `<br>${sigBlock}<br>${bodyToRender}` : `${bodyToRender}${sigBlock}`;
4010
+ if (init.mode !== "draft" && !init.draftUid) {
4011
+ let sigHtml = "";
4012
+ if (acct?.sig?.text) {
4013
+ sigHtml = acct.sig.html ? acct.sig.text : escapeHtml(acct.sig.text).replace(/\n/g, "<br>");
4014
+ } else if (acct?.signature) {
4015
+ sigHtml = acct.signature;
4016
+ }
4017
+ if (sigHtml) {
4018
+ const sigBlock = `<br><br>-- <br>${sigHtml}`;
4019
+ bodyToRender = isReplyForward ? `<br>${sigBlock}<br>${bodyToRender}` : `${bodyToRender}${sigBlock}`;
4020
+ }
4013
4021
  }
4014
4022
  if (bodyToRender) {
4015
4023
  editor.setHtml(bodyToRender);