Skip to content

feat(iOS): add custom style#641

Open
kacperzolkiewski wants to merge 9 commits into
@kacperzolkiewski/custom-stylefrom
@kacperzolkiewski/feat-custom-style
Open

feat(iOS): add custom style#641
kacperzolkiewski wants to merge 9 commits into
@kacperzolkiewski/custom-stylefrom
@kacperzolkiewski/feat-custom-style

Conversation

@kacperzolkiewski

@kacperzolkiewski kacperzolkiewski commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

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

OS Implemented
iOS
Android

Checklist

  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 setStyle imperative command and emits customStyle in state/context-menu events.
  • Implements iOS CustomStyle/CustomStyleData to 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.

Comment thread ios/htmlParser/HtmlParser.mm Outdated
Comment thread ios/EnrichedTextInputView.mm Outdated
Comment thread ios/extensions/ColorExtension.mm Outdated
Comment thread ios/extensions/ColorExtension.mm Outdated
Comment thread src/spec/EnrichedTextInputNativeComponent.ts
Comment thread src/native/EnrichedTextInput.tsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Comment thread src/web/useOnChangeState.ts
Comment thread src/web/EnrichedTextInput.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 31 changed files in this pull request and generated 6 comments.

Comment thread ios/htmlParser/HtmlParser.mm Outdated
Comment thread src/native/EnrichedTextInput.tsx Outdated
Comment thread src/native/EnrichedTextInput.tsx Outdated
Comment thread ios/extensions/ColorExtension.mm
Comment thread src/web/EnrichedTextInput.tsx
@kacperzolkiewski kacperzolkiewski marked this pull request as ready for review June 17, 2026 11:39
@kacperzolkiewski kacperzolkiewski changed the base branch from main to @kacperzolkiewski/custom-style June 17, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants