@bobfrankston/rmfmail 1.1.237 → 1.1.239

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.
@@ -536,23 +536,29 @@ function showSuggestionsMenu(
536
536
  }, 0);
537
537
  }
538
538
 
539
- /** Replace a misspelling marker span with the correction. Done via
540
- * range-based selection + insertText so TinyMCE's undo stack and
541
- * dirty-tracking pick it up properly. */
539
+ /** Replace a misspelling marker span with the correction.
540
+ *
541
+ * Uses TinyMCE's own selection + insertContent API, which focuses the editor
542
+ * iframe, replaces the selection, and registers on the undo stack.
543
+ *
544
+ * The previous implementation called `doc.execCommand("insertText")` directly
545
+ * on the iframe document. That silently failed: the suggestions popup lives in
546
+ * the TOP document (showSuggestionsMenu(document, …)), so clicking a suggestion
547
+ * moves focus OUT of the editor iframe — and Chromium/WebView2 `execCommand` on
548
+ * an UNFOCUSED contenteditable returns `true` while doing nothing. Because it
549
+ * returned truthy, the raw-DOM fallback never ran either, so the correction was
550
+ * simply dropped (Bob 2026-06-11: "spelling corrections not getting applied").
551
+ * editor.focus() + editor.selection.select() makes the replacement land. */
542
552
  function replaceMarker(editor: any, marker: HTMLElement, replacement: string): void {
543
- const doc: Document = editor.getDoc();
544
- const range = doc.createRange();
545
- range.selectNode(marker);
546
- const sel = doc.getSelection();
547
- if (!sel) return;
548
- sel.removeAllRanges();
549
- sel.addRange(range);
550
553
  try {
551
- if (!doc.execCommand("insertText", false, replacement)) {
552
- range.deleteContents();
553
- range.insertNode(doc.createTextNode(replacement));
554
- }
554
+ editor.focus();
555
+ editor.selection.select(marker);
556
+ editor.insertContent(editor.dom.encode(replacement));
555
557
  } catch {
558
+ // Raw-DOM fallback if the editor API is unavailable for any reason.
559
+ const doc: Document = editor.getDoc();
560
+ const range = doc.createRange();
561
+ range.selectNode(marker);
556
562
  range.deleteContents();
557
563
  range.insertNode(doc.createTextNode(replacement));
558
564
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/rmfmail",
3
- "version": "1.1.237",
3
+ "version": "1.1.239",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",