feat(ios): add image support to input#403
Draft
hryhoriiK97 wants to merge 3 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds first-class image support to EnrichedMarkdownTextInput on iOS by tracking image metadata alongside formatting, rendering images via text attachments, supporting copy/paste round-trips, and exposing new JS APIs/events for inserting and handling pasted images.
Changes:
- Introduces an iOS
ENRMImageStore(plusENRMEditAdjusting) and extends parsing/serialization to round-trip images via ORC placeholders andmarkdown. - Adds a new native command (
insertImage) and event (onPasteImages) surfaced through the TS component API and the example app. - Wires new style props (
markdownStyle.image.borderRadius,markdownStyle.inlineImage.size) through the style normalization + native prop pipeline and into the image attachment rendering.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-native-enriched-markdown/src/normalizeMarkdownTextInputStyle.ts | Adds normalized defaults/props for image border radius and inline image size. |
| packages/react-native-enriched-markdown/src/index.tsx | Re-exports new image-related public types. |
| packages/react-native-enriched-markdown/src/EnrichedMarkdownTextInputNativeComponent.ts | Adds codegen props/events/commands for paste images + insert image and new style fields. |
| packages/react-native-enriched-markdown/src/EnrichedMarkdownTextInput.tsx | Adds insertImage imperative API and onPasteImages callback. |
| packages/react-native-enriched-markdown/ios/utils/ENRMImageDownloader.m | Adds support for downloading/loading file:// image URLs. |
| packages/react-native-enriched-markdown/ios/input/ENRMParseResult.h | Extracts parse result into a shared header and adds imageEntries. |
| packages/react-native-enriched-markdown/ios/input/ENRMMarkdownSerializer.h / .mm | Adds image-aware serialization with validation against ORC positions. |
| packages/react-native-enriched-markdown/ios/input/ENRMInputTextView.mm | Intercepts pasted images and emits onPasteImages instead of pasting text. |
| packages/react-native-enriched-markdown/ios/input/ENRMInputParser.h / .mm | Extracts image markdown into ORCs and produces imageEntries. |
| packages/react-native-enriched-markdown/ios/input/ENRMImageStore.h / .mm | New point-based image metadata store with edit adjustment. |
| packages/react-native-enriched-markdown/ios/input/ENRMFormattingStore.h | Makes formatting store conform to shared edit-adjusting protocol. |
| packages/react-native-enriched-markdown/ios/input/ENRMEditAdjusting.h | New shared edit-adjustment protocol. |
| packages/react-native-enriched-markdown/ios/input/EnrichedMarkdownTextInput.h / .mm | Integrates image store, applies image attachments, emits paste images event, and adds insert image command. |
| packages/react-native-enriched-markdown/ios/attachments/ENRMImageAttachment.h / .m | Adds input-specific attachment construction (explicit sizing + border radius) and associates attachment with text view. |
| apps/example/src/screens/playground/PlaygroundScreen.tsx | Demonstrates inserting images and handling pasted images. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ntry creation logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why?
Add image support to
EnrichedMarkdownTextInputon iOS — storing image metadata, inserting ORC placeholders, rendering attachments, serializing to, and handling copy/paste round-trips.ENRMFormattingStore, plus duplicate-position guardreplaceTextInRange:now acceptsENRMParseResultdirectlyimageEntries, leaving orphan ORCs; now threads them throughextractImagesFromPasteboard:into focused static helpersmarkdownStyle.image.borderRadiusandinlineImage.sizewired through full prop pipeline, replacing hardcoded valuesTesting
Screenshots
Nagranie.z.ekranu.2026-06-17.o.13.36.49.mov
PR Checklist