[Cross-platform] Inconsistent image format support between Web and Mobile (SVG, AVIF, HEIC)
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- android, ios, react-native, typescript, web-dev
- Ambito
- frontend, full-stack, mobile
Direzione di ricerca
Start with SanitizationConfig in src/types.ts and the Web sanitization path described in the issue, then trace image decoding through ios/interfaces/ImageAttachment.mm, ios/extensions/ImageExtension.mm, and the Android image classes. First determine which proposed direction maintainers want: configurable Web image filtering, documented format guarantees, or native SVG support. Done means the chosen behavior is consistent and covered across the affected platforms.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
A core use case for react-native-enriched-html is storing a single HTML document produced in <EnrichedTextInput /> on Web (or Mobile) and rendering/editing the exact same HTML across Web, iOS, and Android.
Currently, supported image formats differ silently across platforms, so HTML created or pasted on Web renders fine in the browser but shows broken placeholders on iOS and Android:
- Web (
EnrichedImageNodeView.tsx):- Delegates directly to browser
<img>, so it renders SVG (image/svg+xml/.svg), AVIF, etc., without restriction (e.g. when pasted from external websites).
- Delegates directly to browser
- iOS (
ios/interfaces/ImageAttachment.mm+ios/extensions/ImageExtension.mm):- Decodes via Apple ImageIO (
CGImageSourceCreateWithData/UIImage). - SVG is unsupported ->
UIImagefails and falls back to[UIImage systemImageNamed:@"photo"]. - AVIF fails on older iOS versions.
- Decodes via Apple ImageIO (
- Android (
android/.../AsyncDrawable.kt+EnrichedImageSpan.kt):- Decodes via
ImageDecoder(API 28+) /BitmapFactory. - SVG is unsupported -> fails and falls back to
R.drawable.broken_image. - AVIF (API 31+) and HEIC depend on Android API level / device codecs, whereas Web (Chrome/Firefox on desktop) does not support HEIC in
<img>.
- Decodes via
Why app code cannot enforce cross-platform compatibility on Web
When users paste HTML content from external websites into <EnrichedTextInput /> on Web, <img src="https://.../diagram.svg"> passes right through prepareHtmlForTiptap / sanitizeHtml and is persisted into the database:
SanitizationConfig(src/types.ts) only exposeslinkRegex, which maps directly to DOMPurify'sALLOWED_URI_REGEXP. Because DOMPurify appliesALLOWED_URI_REGEXPto all URI attributes (<a href>and<img src>), rejecting.svgvialinkRegexalso breaks valid<a href="...svg">hyperlinks.EnrichedTextInputkeeps TipTap'seditorandtransformPastedHTMLinternal, so app code cannot cleanly filter out non-cross-platform image URLs (.svg,.avif,.heic, etc.) during HTML paste without brittle DOM/clipboard hacks.
Suggested improvements
- Separate image URI filtering on Web (
SanitizationConfigor prop): Allow configuring image URI filtering independently from links (e.g.imageRegexorshouldAllowImage/transformPastedImage), so apps sharing HTML between Web and Mobile can ensure only cross-platform formats (PNG,JPEG,WebP,GIF) enter the document. - Document guaranteed cross-platform formats (or align SVG/decoding): Explicitly document the safe cross-platform image subset across Web/iOS/Android, and consider either supporting SVG natively on mobile or exposing consistent error handling across Web, iOS, and Android.
Environment
react-native-enriched-html:1.2.0- Platforms: Web (
@tiptap/react), iOS (ImageAttachment), Android (AsyncDrawable/EnrichedImageSpan)
- 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
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
software-mansion/react-native-enriched-html#885 ·
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 ·