@bobfrankston/rmfmail 1.1.162 → 1.1.163

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.
@@ -746,7 +746,21 @@ async function createTinyMceEditor(container2, opts = {}) {
746
746
  const ZOOM_STEP = 2;
747
747
  const ZOOM_MIN = 8;
748
748
  const ZOOM_MAX = 32;
749
+ const ZOOM_STORAGE_KEY = "rmf-tiny:zoom-px";
749
750
  let zoomPx = ZOOM_DEFAULT;
751
+ try {
752
+ const stored = Number(localStorage.getItem(ZOOM_STORAGE_KEY));
753
+ if (Number.isFinite(stored) && stored >= ZOOM_MIN && stored <= ZOOM_MAX) {
754
+ zoomPx = stored;
755
+ }
756
+ } catch {
757
+ }
758
+ const saveZoom = () => {
759
+ try {
760
+ localStorage.setItem(ZOOM_STORAGE_KEY, String(zoomPx));
761
+ } catch {
762
+ }
763
+ };
750
764
  const applyZoom = () => {
751
765
  try {
752
766
  const body = ed.getBody();
@@ -758,6 +772,7 @@ async function createTinyMceEditor(container2, opts = {}) {
758
772
  const bumpZoom = (delta) => {
759
773
  zoomPx = Math.max(ZOOM_MIN, Math.min(ZOOM_MAX, zoomPx + delta));
760
774
  applyZoom();
775
+ saveZoom();
761
776
  };
762
777
  ed.ui.registry.addMenuItem("zoomIn", {
763
778
  text: "Zoom in",
@@ -775,6 +790,7 @@ async function createTinyMceEditor(container2, opts = {}) {
775
790
  onAction: () => {
776
791
  zoomPx = ZOOM_DEFAULT;
777
792
  applyZoom();
793
+ saveZoom();
778
794
  }
779
795
  });
780
796
  const installLinkEscape = () => {
@@ -830,6 +846,8 @@ async function createTinyMceEditor(container2, opts = {}) {
830
846
  doc.documentElement.setAttribute("lang", "en");
831
847
  } catch {
832
848
  }
849
+ if (zoomPx !== ZOOM_DEFAULT)
850
+ applyZoom();
833
851
  try {
834
852
  const doc = ed.getDoc();
835
853
  doc.addEventListener("wheel", (e) => {
@@ -1964,6 +1982,9 @@ function decorate(editor2, sp) {
1964
1982
  const doc = editor2.getDoc?.();
1965
1983
  if (!body || !doc)
1966
1984
  return;
1985
+ const _activeSel = doc.getSelection();
1986
+ if (_activeSel && _activeSel.rangeCount > 0 && !_activeSel.isCollapsed)
1987
+ return;
1967
1988
  let savedFocusNode = null;
1968
1989
  let savedFocusOffset = 0;
1969
1990
  const _preSel = doc.getSelection();
@@ -2289,6 +2310,9 @@ function cleanupCorrected(editor2, sp) {
2289
2310
  const doc = editor2.getDoc?.();
2290
2311
  if (!body || !doc)
2291
2312
  return;
2313
+ const activeSel = doc.getSelection();
2314
+ if (activeSel && activeSel.rangeCount > 0 && !activeSel.isCollapsed)
2315
+ return;
2292
2316
  const markers = body.querySelectorAll(`span[${MARKER_ATTR}]`);
2293
2317
  if (markers.length === 0)
2294
2318
  return;