@bobfrankston/rmfmail 1.2.131 → 1.2.133

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.
@@ -724,11 +724,23 @@ function showContextMenu(x, y, items) {
724
724
  menu.style.left = `${x}px`;
725
725
  menu.style.top = `${y}px`;
726
726
  document.body.appendChild(menu);
727
- const rect = menu.getBoundingClientRect();
728
- if (rect.right > window.innerWidth)
729
- menu.style.left = `${x - rect.width}px`;
730
- if (rect.bottom > window.innerHeight)
731
- menu.style.top = `${y - rect.height}px`;
727
+ const vw = window.visualViewport?.width ?? window.innerWidth;
728
+ const vh = window.visualViewport?.height ?? window.innerHeight;
729
+ let rect = menu.getBoundingClientRect();
730
+ if (rect.height > vh - 8) {
731
+ menu.style.maxHeight = `${vh - 8}px`;
732
+ menu.style.overflowY = "auto";
733
+ rect = menu.getBoundingClientRect();
734
+ }
735
+ let left = x, top = y;
736
+ if (left + rect.width > vw)
737
+ left = x - rect.width;
738
+ if (top + rect.height > vh)
739
+ top = y - rect.height;
740
+ left = Math.max(4, Math.min(left, vw - rect.width - 4));
741
+ top = Math.max(4, Math.min(top, vh - rect.height - 4));
742
+ menu.style.left = `${left}px`;
743
+ menu.style.top = `${top}px`;
732
744
  activeMenu = menu;
733
745
  requestAnimationFrame(() => {
734
746
  dismissListener = (e) => {
@@ -1188,6 +1200,8 @@ function showPreviewBodyMenu(absX, absY, selectedText, sourceWindow, linkUrl, li
1188
1200
  input.dispatchEvent(new Event("input"));
1189
1201
  input.dispatchEvent(new KeyboardEvent("keydown", { key: "Enter", bubbles: true }));
1190
1202
  input.focus();
1203
+ document.getElementById("message-viewer")?.classList.remove("narrow-active");
1204
+ document.getElementById("message-list")?.classList.remove("narrow-hidden");
1191
1205
  };
1192
1206
  const tellIframe = (cmd) => {
1193
1207
  try {