@bobfrankston/rmfmail 1.2.119 → 1.2.120

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
@@ -5222,8 +5222,27 @@ getSettings().then((s: any) => {
5222
5222
  if (optEditorQuill) optEditorQuill.checked = ed === "quill";
5223
5223
  if (optEditorTiptap) optEditorTiptap.checked = ed === "tiptap";
5224
5224
  if (optEditorTinymce) optEditorTinymce.checked = ed === "tinymce";
5225
+ const fontEl = document.getElementById("opt-compose-font-size") as HTMLInputElement | null;
5226
+ if (fontEl) {
5227
+ const px = Number(s.ui?.composeFontSize);
5228
+ fontEl.value = String(Number.isFinite(px) && px >= 8 && px <= 32 ? px : 15);
5229
+ }
5225
5230
  }).catch(() => {});
5226
5231
 
5232
+ // Unified compose editing font size (px). Same sync-cache-then-persist shape
5233
+ // as saveEditorSetting: compose.ts reads `mailx-compose-font-size` from
5234
+ // localStorage at module load, so the very next compose-open is correct.
5235
+ document.getElementById("opt-compose-font-size")?.addEventListener("change", (e) => {
5236
+ const el = e.target as HTMLInputElement;
5237
+ const px = Number(el.value);
5238
+ if (!Number.isFinite(px) || px < 8 || px > 32) return;
5239
+ try { localStorage.setItem("mailx-compose-font-size", String(px)); } catch { /* */ }
5240
+ getSettings().then((settings: any) => {
5241
+ settings.ui = { ...settings.ui, composeFontSize: px };
5242
+ saveSettings(settings);
5243
+ }).catch(() => {});
5244
+ });
5245
+
5227
5246
  // Save editor choice to server settings
5228
5247
  function saveEditorSetting(editor: string): void {
5229
5248
  // Update the localStorage cache SYNCHRONOUSLY. compose.ts reads
@@ -2173,7 +2173,7 @@ async function createTinyMceEditor(container2, opts = {}) {
2173
2173
  // an undefined/oversized line-height plus per-line font-size
2174
2174
  // changes threw it off. A definite, tight line-height gives the
2175
2175
  // marker a stable baseline to sit under.
2176
- "body { font-family: system-ui, sans-serif; font-size: 14px; line-height: 1.3; caret-color: #0a2647; }",
2176
+ `body { font-family: system-ui, sans-serif; font-size: ${opts.fontSizePx ?? 14}px; line-height: 1.3; caret-color: #0a2647; }`,
2177
2177
  "blockquote { border-left: 3px solid #c0c8d0; margin: 0 0 0 4px; padding: 2px 0 2px 10px; color: #555; }",
2178
2178
  // Drop the 0.5em margin-gap above the reply block and the per-line
2179
2179
  // font-size shrink on the attribution line — both contributed to
@@ -2187,7 +2187,7 @@ async function createTinyMceEditor(container2, opts = {}) {
2187
2187
  setup: (ed) => {
2188
2188
  if (opts.initialHtml)
2189
2189
  ed.on("init", () => ed.setContent(opts.initialHtml));
2190
- const ZOOM_DEFAULT = 14;
2190
+ const ZOOM_DEFAULT = opts.fontSizePx ?? 14;
2191
2191
  const ZOOM_STEP = 2;
2192
2192
  const ZOOM_MIN = 8;
2193
2193
  const ZOOM_MAX = 32;
@@ -3672,7 +3672,8 @@ async function createTinyMceEditor2(container2, opts = {}) {
3672
3672
  } catch {
3673
3673
  }
3674
3674
  const m = await Promise.resolve().then(() => (init_rmf_tiny(), rmf_tiny_exports));
3675
- const ed = await m.createTinyMceEditor(container2, { cdnUrl, apiKey, onFiles: opts.onFiles });
3675
+ const cssPx = parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--compose-font-size"));
3676
+ const ed = await m.createTinyMceEditor(container2, { cdnUrl, apiKey, onFiles: opts.onFiles, fontSizePx: Number.isFinite(cssPx) ? cssPx : void 0 });
3676
3677
  return ed;
3677
3678
  }
3678
3679
 
@@ -3823,6 +3824,18 @@ try {
3823
3824
  if (cached === "tiptap" || cached === "quill" || cached === "tinymce") editorType = cached;
3824
3825
  } catch {
3825
3826
  }
3827
+ var COMPOSE_FONT_MIN_PX = 8;
3828
+ var COMPOSE_FONT_MAX_PX = 32;
3829
+ var COMPOSE_FONT_DEFAULT_PX = 15;
3830
+ function applyComposeFontSize(px) {
3831
+ if (!Number.isFinite(px) || px < COMPOSE_FONT_MIN_PX || px > COMPOSE_FONT_MAX_PX) px = COMPOSE_FONT_DEFAULT_PX;
3832
+ document.documentElement.style.setProperty("--compose-font-size", `${px}px`);
3833
+ }
3834
+ try {
3835
+ applyComposeFontSize(Number(localStorage.getItem("mailx-compose-font-size")));
3836
+ } catch {
3837
+ applyComposeFontSize(COMPOSE_FONT_DEFAULT_PX);
3838
+ }
3826
3839
  (async () => {
3827
3840
  try {
3828
3841
  appSettings = await getSettings();
@@ -3832,6 +3845,14 @@ try {
3832
3845
  localStorage.setItem("mailx-editor-type", next);
3833
3846
  } catch {
3834
3847
  }
3848
+ const fontPx = Number(appSettings?.ui?.composeFontSize);
3849
+ if (Number.isFinite(fontPx) && fontPx >= COMPOSE_FONT_MIN_PX && fontPx <= COMPOSE_FONT_MAX_PX) {
3850
+ try {
3851
+ localStorage.setItem("mailx-compose-font-size", String(fontPx));
3852
+ } catch {
3853
+ }
3854
+ applyComposeFontSize(fontPx);
3855
+ }
3835
3856
  } catch {
3836
3857
  }
3837
3858
  })();