feat(iOS): add custom style#641
Open
kacperzolkiewski wants to merge 13 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an iOS-only “custom style” layer to support per-range foreground/background colors, including native commands/state events and HTML span parsing/serialization.
Changes:
- Exposes a new
setStyleimperative command and emitscustomStylein state/context-menu events. - Implements iOS
CustomStyle/CustomStyleDatato apply per-range colors and integrates it into style application priority. - Parses
<span style="color: ...; background-color: ...">into native style data and serializes custom styles back to HTML.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/web/useOnChangeState.ts | Adds default customStyle fields to the web state shape. |
| src/web/EnrichedTextInput.tsx | Adds a setStyle no-op to the web imperative handle. |
| src/types.ts | Extends public TS types with customStyle and setStyle(...). |
| src/spec/EnrichedTextInputNativeComponent.ts | Adds customStyle to events and introduces the setStyle native command in the codegen spec. |
| src/native/EnrichedTextInput.tsx | Implements setStyle command payload creation (processColor + JSON). |
| ios/utils/StyleUtils.mm | Registers CustomStyle in conflict/blocking maps and style registries. |
| ios/textHtmlParser/TextHtmlParser.mm | Applies CustomStyle when processing styles from HTML (viewer path). |
| ios/styles/EnrichedTextStyles.mm | Adds EnrichedTextCustomStyle implementation hook. |
| ios/styles/CustomStyle.mm | New iOS style implementation applying fg/bg colors via attributed text. |
| ios/interfaces/StyleTypeEnum.h | Adds Custom style type. |
| ios/interfaces/StyleHeaders.h | Declares CustomStyle interface in shared style headers. |
| ios/interfaces/StyleBase.mm | Introduces stylePriority default implementation. |
| ios/interfaces/StyleBase.h | Exposes stylePriority on the base style protocol. |
| ios/interfaces/EnrichedTextStyleHeaders.h | Adds EnrichedTextCustomStyle header. |
| ios/inputHtmlParser/InputHtmlParser.mm | Applies CustomStyle when processing styles from HTML (input path). |
| ios/inputAttributesManager/InputAttributesManager.mm | Changes style application ordering to use stylePriority. |
| ios/htmlParser/HtmlParser.mm | Parses/serializes custom styles as <span style="..."> and splits spans when data changes. |
| ios/extensions/ColorExtension.mm | Adds rgba string conversion + rgba parsing helpers. |
| ios/extensions/ColorExtension.h | Declares rgba helpers in the UIColor category. |
| ios/EnrichedTextInputView.mm | Implements setStyle command handling and emits customStyle in events. |
| ios/customStyleData/CustomStyleData.mm | New data object storing fg/bg UIColors with merge/equality/copy. |
| ios/customStyleData/CustomStyleData.h | Declares CustomStyleData API. |
| apps/example/src/constants/editorConfig.ts | Extends example default editor state with customStyle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Summary Disabled the autocorrection in e2e maestro testing devices to prevent unexpected behavior. ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | | Android | ✅ | ## Checklist - [x] E2E tests are passing - [ ] Required E2E tests have been added (if applicable)
# Summary Web implementation was missing the HTML normalizer - implemented the normalizer, mirroring the one in the native code - tests also mirror the native ones ## Test Plan Try pasting styled text from `Google Docs`, `MS Word` or any other platform ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ❌ | | Android | ❌ | | Web | ✅ | ## Checklist - [x] E2E tests are passing - [ ] Required E2E tests have been added (if applicable)
# Summary Apply priority to android spans that inline spans will be applied after paragraph spans. See: https://stackoverflow.com/questions/46002947/how-to-define-order-setpriority-of-spannable-in-android ## Test Plan Play around with styles on android and check if inline styles override paragraph styles. For example: Inline code inside blockquote. ## Screenshots / Videos https://github.com/user-attachments/assets/9bacb687-ad62-43fe-a0d0-4c135548f1ef ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ❌ | | Android | ✅ | ## Checklist - [x] E2E tests are passing - [ ] Required E2E tests have been added (if applicable)
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.
Summary
Add custom style for foreground and background colors handling
Test Plan
Run the example app and experiment with applying foreground and background colors through the toolbar across different text styles.
Screenshots / Videos
Screen.Recording.2026-06-17.at.13.38.30.mov
Compatibility
Checklist