@bobfrankston/rmfmail 1.1.90 → 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,7 +1,11 @@
1
- Search history records live (no-Enter) searches too
1
+ Fix: typing after a URL no longer swallows text into the link
2
2
 
3
- Search history only recorded on Enter, so a search typed and run
4
- live ("Hoddie") never appeared in the history dropdown. Every executed
5
- search is now recorded; recordSearchHistory() prunes any entry that is a
6
- prefix of the new query, collapsing the keystroke progression ("Hod",
7
- "Hodd") into the final term so it lands in history exactly once.
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();