Skip to content

RichText: Enhance custom styling and formatting options - #2129

Open
UsrRian wants to merge 1 commit into
pnp:devfrom
UsrRian:richtext-customstyles-20260811-140758
Open

RichText: Enhance custom styling and formatting options#2129
UsrRian wants to merge 1 commit into
pnp:devfrom
UsrRian:richtext-customstyles-20260811-140758

Conversation

@UsrRian

@UsrRian UsrRian commented Aug 11, 2026

Copy link
Copy Markdown
  • Added customStyles prop to IRichTextProps for applying object-based formatting styles.
  • Introduced IRichTextCustomFormattingStyles interface to define styles for various rich text elements.
  • Updated RichTextPropertyPane to support custom font sizes and colors from customStyles.
  • Implemented logic to read computed styles from rendered elements to keep formatting values in sync.
  • Enhanced the font size dropdown to include custom sizes detected in the editor.
  • Merged custom color swatches for font and background colors in the color picker.
  • Added toggles in ControlsTest for enabling/disabling edit mode and custom formatting.
  • Updated styles in RteColorPicker for better visual consistency.
  • Added new styles for rich text actions in ControlsTest.module.scss.
Q A
Bug fix? [x]
New feature? [x]
New sample? [x]
Related issues? fixes #1731, partially #1204

What's in this Pull Request?

This PR adds support for object-based custom formatting for RichText component and improves how the formatting side panel reflects actual rendered styles. It also updates docs and the ControlsTest demo so the behavior can be validated easily.

Before this change, RichText didnt have themed border on activation, when clicking on a text didnt show the actual size unless explicitly defined and didnt allow for any custom styles (yes you could apply styles by wrapping it in some div with style definitions, but those wouldnt reflect in the formating panel). Also there were couple of small things, like broken css and missing props in docs. ALso changed the rendering of the toolbar, which was placed strangely. Now editor is wrapped with "position: relative".

Tried to do as little damage as possible, to be considered for minor update.

- Added `customStyles` prop to `IRichTextProps` for applying object-based formatting styles.
- Introduced `IRichTextCustomFormattingStyles` interface to define styles for various rich text elements.
- Updated `RichTextPropertyPane` to support custom font sizes and colors from `customStyles`.
- Implemented logic to read computed styles from rendered elements to keep formatting values in sync.
- Enhanced the font size dropdown to include custom sizes detected in the editor.
- Merged custom color swatches for font and background colors in the color picker.
- Added toggles in `ControlsTest` for enabling/disabling edit mode and custom formatting.
- Updated styles in `RteColorPicker` for better visual consistency.
- Added new styles for rich text actions in `ControlsTest.module.scss`.
@UsrRian UsrRian changed the title feat(RichText): Enhance custom styling and formatting options RichText: Enhance custom styling and formatting options Aug 11, 2026
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