@bobfrankston/rmfmail 1.2.119 → 1.2.121
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.bundle.js +19 -0
- package/client/app.bundle.js.map +2 -2
- package/client/app.js +22 -0
- package/client/app.js.map +1 -1
- package/client/app.ts +19 -0
- package/client/compose/compose.bundle.js +44 -3
- package/client/compose/compose.bundle.js.map +2 -2
- package/client/compose/compose.css +4 -2
- package/client/compose/compose.js +31 -0
- package/client/compose/compose.js.map +1 -1
- package/client/compose/compose.ts +25 -0
- package/client/compose/editor.js +5 -1
- package/client/compose/editor.js.map +1 -1
- package/client/compose/editor.ts +6 -2
- package/client/index.html +1 -0
- package/client/lib/rmf-tiny.js +39 -2
- package/package.json +3 -3
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
|
-
|
|
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,27 @@ async function createTinyMceEditor(container2, opts = {}) {
|
|
|
2187
2187
|
setup: (ed) => {
|
|
2188
2188
|
if (opts.initialHtml)
|
|
2189
2189
|
ed.on("init", () => ed.setContent(opts.initialHtml));
|
|
2190
|
-
|
|
2190
|
+
ed.on("GetContent", (e) => {
|
|
2191
|
+
if (!e?.content || typeof e.content !== "string" || !e.content.includes("blob:"))
|
|
2192
|
+
return;
|
|
2193
|
+
e.content = e.content.replace(/src="(blob:[^"]+)"/g, (m, uri) => {
|
|
2194
|
+
const info = ed.editorUpload?.blobCache?.getByUri?.(uri);
|
|
2195
|
+
return info ? `src="data:${info.blob().type};base64,${info.base64()}"` : m;
|
|
2196
|
+
});
|
|
2197
|
+
});
|
|
2198
|
+
ed.on("OpenWindow", () => {
|
|
2199
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
2200
|
+
const ta = document.querySelector(".tox-dialog textarea");
|
|
2201
|
+
if (ta && ta.value) {
|
|
2202
|
+
try {
|
|
2203
|
+
ta.setSelectionRange(0, 0);
|
|
2204
|
+
ta.scrollTop = 0;
|
|
2205
|
+
} catch {
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
}));
|
|
2209
|
+
});
|
|
2210
|
+
const ZOOM_DEFAULT = opts.fontSizePx ?? 14;
|
|
2191
2211
|
const ZOOM_STEP = 2;
|
|
2192
2212
|
const ZOOM_MIN = 8;
|
|
2193
2213
|
const ZOOM_MAX = 32;
|
|
@@ -3672,7 +3692,8 @@ async function createTinyMceEditor2(container2, opts = {}) {
|
|
|
3672
3692
|
} catch {
|
|
3673
3693
|
}
|
|
3674
3694
|
const m = await Promise.resolve().then(() => (init_rmf_tiny(), rmf_tiny_exports));
|
|
3675
|
-
const
|
|
3695
|
+
const cssPx = parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--compose-font-size"));
|
|
3696
|
+
const ed = await m.createTinyMceEditor(container2, { cdnUrl, apiKey, onFiles: opts.onFiles, fontSizePx: Number.isFinite(cssPx) ? cssPx : void 0 });
|
|
3676
3697
|
return ed;
|
|
3677
3698
|
}
|
|
3678
3699
|
|
|
@@ -3823,6 +3844,18 @@ try {
|
|
|
3823
3844
|
if (cached === "tiptap" || cached === "quill" || cached === "tinymce") editorType = cached;
|
|
3824
3845
|
} catch {
|
|
3825
3846
|
}
|
|
3847
|
+
var COMPOSE_FONT_MIN_PX = 8;
|
|
3848
|
+
var COMPOSE_FONT_MAX_PX = 32;
|
|
3849
|
+
var COMPOSE_FONT_DEFAULT_PX = 15;
|
|
3850
|
+
function applyComposeFontSize(px) {
|
|
3851
|
+
if (!Number.isFinite(px) || px < COMPOSE_FONT_MIN_PX || px > COMPOSE_FONT_MAX_PX) px = COMPOSE_FONT_DEFAULT_PX;
|
|
3852
|
+
document.documentElement.style.setProperty("--compose-font-size", `${px}px`);
|
|
3853
|
+
}
|
|
3854
|
+
try {
|
|
3855
|
+
applyComposeFontSize(Number(localStorage.getItem("mailx-compose-font-size")));
|
|
3856
|
+
} catch {
|
|
3857
|
+
applyComposeFontSize(COMPOSE_FONT_DEFAULT_PX);
|
|
3858
|
+
}
|
|
3826
3859
|
(async () => {
|
|
3827
3860
|
try {
|
|
3828
3861
|
appSettings = await getSettings();
|
|
@@ -3832,6 +3865,14 @@ try {
|
|
|
3832
3865
|
localStorage.setItem("mailx-editor-type", next);
|
|
3833
3866
|
} catch {
|
|
3834
3867
|
}
|
|
3868
|
+
const fontPx = Number(appSettings?.ui?.composeFontSize);
|
|
3869
|
+
if (Number.isFinite(fontPx) && fontPx >= COMPOSE_FONT_MIN_PX && fontPx <= COMPOSE_FONT_MAX_PX) {
|
|
3870
|
+
try {
|
|
3871
|
+
localStorage.setItem("mailx-compose-font-size", String(fontPx));
|
|
3872
|
+
} catch {
|
|
3873
|
+
}
|
|
3874
|
+
applyComposeFontSize(fontPx);
|
|
3875
|
+
}
|
|
3835
3876
|
} catch {
|
|
3836
3877
|
}
|
|
3837
3878
|
})();
|