Overview
TheTextStyleConfiguration class defines the common text styling configuration for the editor. It controls the appearance of formatted text including bold, italic, underline, strikethrough, links, and code.
This configuration is used by all text-based components in the editor as the default styling. Individual block components may override these styles with their own BlockComponentConfiguration.
Constructor
TextStyleConfiguration()
Creates a text style configuration with customizable properties for different text formats.Properties
Text Formatting Styles
The default text style for regular, unformatted text.This is the base style applied to all text in the editor before any formatting attributes are applied.
The text style applied to bold text.By default, uses bold font weight. You can customize this to use a different font weight, color, or other properties.
The text style applied to italic text.By default, uses italic font style.
The text style applied to underlined text.By default, applies an underline decoration. You can customize the decoration color, style (solid, dotted, dashed), or thickness.
The text style applied to strikethrough text.By default, applies a line-through decoration.
The text style applied to hyperlinks.By default, displays links in light blue with an underline.
The text style applied to inline code.By default, displays code in red text with a light cyan background.
The text style applied to autocomplete suggestions.By default, displays suggestions in grey.
Line Height Configuration
The line height multiplier for text.A value of 1.5 means the line height is 1.5 times the font size. Adjust this to control spacing between lines of text.
Whether to apply line height to the first line’s ascent.When true, the line height is applied to the top of the first line. When false, the first line’s natural ascent is preserved.
Whether to apply line height to the last line’s descent.When true, the line height is applied to the bottom of the last line. When false, the last line’s natural descent is preserved.
How the leading (extra space from line height) is distributed around the text.
TextLeadingDistribution.even- Distributes space evenly above and below the textTextLeadingDistribution.proportional- Distributes space proportional to the font metrics
Methods
copyWith()
Creates a copy of the currentTextStyleConfiguration with the specified properties updated.
Usage Examples
Basic Configuration
Custom Link and Code Styling
Custom Line Height Configuration
Comprehensive Customization
Modifying Existing Configuration
Related
- EditorStyle - Configure the overall editor appearance
- BlockComponentConfiguration - Configure individual block components