[Web] Manual <a href="URL">URL</a> links adjacent to non-whitespace characters are stripped on initial mount / setValue
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Start with src/web/formats/EnrichedLink.ts and src/web/pmPlugins/AutolinkPlugin/index.ts, then trace how setContent triggers the plugin on initial mount. Check the link parsing and autolink transaction behavior for URL links adjacent to other text. Done means the manual link remains in the editor HTML after remount or setValue, including the punctuation and adjacent word cases in the issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
On web, when <EnrichedTextInput> loads HTML containing a link whose text matches its href (for example inserted manually via ref.current.setLink(...) without surrounding spaces, or wrapped in punctuation like (https://example.com)), the <a> mark is silently stripped on initial mount / setContent.
Minimal Reproduction
<EnrichedTextInput
defaultValue='<html><p>foo<a href="https://example.com">https://example.com</a>bar</p></html>'
/>
Or programmatically / via toolbar:
- Place cursor inside existing word
foobar(betweenfooandbar). - Insert link via
editor.setLink(start, end, "https://example.com", "https://example.com").- Before reload,
getHTML()preserves<p>foo<a href="https://example.com">https://example.com</a>bar</p>.
- Before reload,
- Remount
<EnrichedTextInput>with that saved HTML indefaultValue(or callsetValue(...)).
Expected:
The <a href="https://example.com">https://example.com</a> link is preserved.
Actual:
The link mark is stripped and only plain text foohttps://example.combar remains in the editor DOM.
Root Cause (in [email protected])
EnrichedLink(src/web/formats/EnrichedLink.ts,addAttributes().auto.parseHTML) classifies any parsed<a href="X">X</a>asauto: truewheneverhref === el.textContentandisFullLinkMatch(href, linkRegex)is true (unlesslinkRegex === null). BecauserenderHTMLdoes not persist whether a link was manual or auto, manually created URL links come back asauto: trueon reload.- Immediately on
onCreate→editor.commands.setContent(...)(src/web/EnrichedTextInput.tsx),AutolinkPlugin(src/web/pmPlugins/AutolinkPlugin/index.ts) runsappendTransaction:- It splits block runs by whitespace (
/\S+/g), yielding the full token"foohttps://example.combar". - It requires a full-word match (
r.start === 0 && r.endExclusive === word.length), which isfalse. removeAutoLinksInRangethen removes everylinkmark withattrs.auto === true.
- It splits block runs by whitespace (
The same happens for cases like (<a href="https://example.com">https://example.com</a>) or any URL-labeled link touching non-whitespace characters on either side.
Environment
react-native-enriched-html:1.2.0- Platform: Web (
Chrome, Tiptap3.31.3)
- Lingua principale
- C
- Stelle
- 1.4k
- Fork
- 80
- Merge medio
- 4g 19h
- PR unite (30g)
- 21
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di software-mansion/react-native-enriched-html
-
[Web] Leading, trailing, and consecutive spaces in <p> and <codeblock> are stripped by setContent on mount / setValueForse già presa @pcbeingused333 l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
software-mansion/react-native-enriched-html#886 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
software-mansion/react-native-enriched-html#881 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
software-mansion/react-native-enriched-html#880 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
software-mansion/react-native-enriched-html#878 ·
I maintainer di solito rispondono entro 2 giorni
-
[Android] Leading and consecutive spaces are lost when HTML is parsed (iOS keeps them)Forse già presa @szydlovsky l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
software-mansion/react-native-enriched-html#877 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di software-mansion/react-native-enriched-html
Issue simili
-
[Android Auto] MU1017 (MHI2Q_JP_AUG22_P1017) cluster map works with a pinned profile — values insideAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
kamgurgul/mib2q-carplay#74 ·
-
Claude:NotNeeded GPT:NotABug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
open5gs/open5gs#5195 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
FriendsofECCE/ECCE#1358 ·
-
documentation needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
X11Libre/xserver#4255 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
antoxa2584x/nfsu2-sw#52 ·