How mohamedrejeb/compose-rich-editor works
Data flow and interactions
• User Input & State Management:
• That the user interacts with the RichTextEditor composable which in turn uses RichTextState for managing and updating text content.
• Styling and Formatting:
• Parsing Integration:
• Parsing modules (for HTML and Markdown) that receive data (such as imported HTML/Markdown content) and update the RichTextState, and vice versa (output operations like toHtml() and toMarkdown()).
• Platform Abstraction:
• External Dependencies:
• External services like Coil3 as an optional integration that the “richeditor-compose-coil3” module connects to (for image loading support).
Architectural patterns and design principles
• Multiplatform Architecture – Clearly separate the shared “commonMain” code (business logic, UI definitions, parsing utilities) from the “actual” platform-specific implementations.
• Composable Architecture – The system leverages composable functions (rich editor UI composition) to keep the UI flexible and declarative.
• Separation of Concerns – The library defines distinct layers: UI layer (composables), state management (RichTextState), parsing layer (HTML/Markdown converters), and platform abstraction layer.
Important Notes
• Be very detailed: capture every essential module and show relationships such as dependency and data flow.
• Don’t overcomplicate by creating too many small components – aim for a balance by splitting into major functional areas (i.e., Core, Platform, External, Sample Clients).
• How the “RichTextState” connects with both styling functions (e.g., toggleSpanStyle, toggleParagraphStyle) and parse methods (setHtml, toHtml, setMarkdown, toMarkdown).