@bobfrankston/rmfmail 1.1.89 → 1.1.91

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/.commitmsg CHANGED
@@ -1,8 +1,11 @@
1
- Spellcheck: disable the native checker so only nspell runs
1
+ Fix: typing after a URL no longer swallows text into the link
2
2
 
3
- The compose editor had BOTH the native Chromium/WebView2 spellchecker and
4
- mailx's own nspell checker active double red underlines everywhere
5
- ("why so much red twiddle") and right-click popping the native
6
- suggestion menu instead of ours. wireSpellcheck now forces
7
- spellcheck="false" on the editor body (with a MutationObserver to keep
8
- it off), so nspell is the single source of squiggles and suggestions.
3
+ In the TinyMCE editor, typing or pasting a URL auto-linked it, but the
4
+ caret stayed inside the <a>, so every following character was appended
5
+ into the link text a whole sentence turned into one link.
6
+
7
+ rmf-tiny's adapter now has a keypress handler: when a printable key is
8
+ pressed with the caret collapsed at the trailing edge of an <a>, the
9
+ caret hops to just after the <a> first, so the new text lands outside
10
+ the link. Covers autolink, pasted URLs, and hand-made links.
11
+ (client/lib/rmf-tiny.js rebuilt from the adapter source.)
@@ -742,6 +742,30 @@ async function createTinyMceEditor(container2, opts = {}) {
742
742
  applyZoom();
743
743
  }
744
744
  });
745
+ ed.on("keypress", (e) => {
746
+ if (e.ctrlKey || e.altKey || e.metaKey)
747
+ return;
748
+ const sel = ed.selection;
749
+ const rng = sel.getRng();
750
+ if (!rng || !rng.collapsed)
751
+ return;
752
+ const a = ed.dom.getParent(sel.getNode(), "a");
753
+ if (!a)
754
+ return;
755
+ let tail;
756
+ try {
757
+ tail = rng.cloneRange();
758
+ tail.setEndAfter(a);
759
+ } catch {
760
+ return;
761
+ }
762
+ if (tail.toString().length > 0)
763
+ return;
764
+ const after = ed.getDoc().createRange();
765
+ after.setStartAfter(a);
766
+ after.collapse(true);
767
+ sel.setRng(after);
768
+ });
745
769
  ed.on("init", () => {
746
770
  try {
747
771
  const body = ed.getBody();