@bobfrankston/rmfmail 1.2.120 → 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.
@@ -2187,6 +2187,26 @@ async function createTinyMceEditor(container2, opts = {}) {
2187
2187
  setup: (ed) => {
2188
2188
  if (opts.initialHtml)
2189
2189
  ed.on("init", () => ed.setContent(opts.initialHtml));
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
+ });
2190
2210
  const ZOOM_DEFAULT = opts.fontSizePx ?? 14;
2191
2211
  const ZOOM_STEP = 2;
2192
2212
  const ZOOM_MIN = 8;