feat: add @rocket.chat/gazzodown-alt package for real-time WYSIWYG rendering#39888
feat: add @rocket.chat/gazzodown-alt package for real-time WYSIWYG rendering#39888MartinSchoeler wants to merge 1 commit intopoc/gazzodown-altfrom
Conversation
…ndering This new package provides an alternative to @rocket.chat/gazzodown that is optimized for real-time rendering in WYSIWYG text fields. Key differences from gazzodown: - Renders paragraphs as <span> instead of <div> for inline layout - Represents line breaks with newline characters instead of <br> tags - No heavy Fuselage UI dependencies (MessageHighlight, CheckBox, etc.) - Minimal footprint suitable for re-rendering on every keystroke - Consumes the same AST from @rocket.chat/message-parser (grammar.pegjs) Exported components: - ComposerMarkup: Main renderer (drop-in for Markup) - ComposerMarkupContext: Context for emoji/mention resolution - Individual inline elements (Bold, Italic, Strike, Code, Emoji, etc.) Co-authored-by: Martin Schoeler <martin.schoeler@rocket.chat>
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## poc/gazzodown-alt #39888 +/- ##
====================================================
Coverage ? 70.85%
====================================================
Files ? 3196
Lines ? 113198
Branches ? 20498
====================================================
Hits ? 80205
Misses ? 30943
Partials ? 2050
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
Adds a new
@rocket.chat/gazzodown-altpackage that provides an alternative to@rocket.chat/gazzodown, optimized for real-time rendering in WYSIWYG text fields (composer/editor contexts).Problem
The existing
gazzodownpackage renders message markup using block-level elements (<div>for paragraphs,<br>for line breaks), which causes issues with newlines when used inside a WYSIWYG input field for real-time preview rendering.Solution
The new
gazzodown-altpackage consumes the same AST produced by@rocket.chat/message-parser(the samegrammar.pegjsfile), but outputs inline-friendly React elements suitable for real-time rendering as the user types:<div>(block)<span>(inline)<br>tags\ncharactersdetectEmoji<span>elements<code>with monospace stylingKey design decisions
<span>to avoid disrupting the flow of a WYSIWYG text fieldComposerMarkupacceptstokens: MessageParser.Rootjust likeMarkupComposerMarkupContextprovides emoji detection, mention resolutionExported components
ComposerMarkup— Main renderer (drop-in alternative forMarkup)ComposerMarkupContext— Context for emoji/mention resolutionComposerInlineElements— Inline element dispatcherComposerBoldSpan,ComposerItalicSpan,ComposerStrikeSpan,ComposerLinkSpan,ComposerCodeElement,ComposerCodeBlock,ComposerEmojiElement,ComposerMentionUser,ComposerMentionChannel,ComposerSpoilerSpan,ComposerColorElement,ComposerImageElement,ComposerTimestamp,ComposerPlainSpanSteps to test or reproduce
ComposerMarkupfrom@rocket.chat/gazzodown-alt@rocket.chat/message-parser'sparse()function<ComposerMarkup tokens={parsedTokens} />inside a WYSIWYG text fieldFurther comments
This package intentionally has zero runtime dependencies beyond React (peer dep). It avoids Fuselage components, hljs, dompurify, and other heavy dependencies that
gazzodownuses, keeping the bundle lightweight for real-time re-rendering on every keystroke.