Skip to content

feat(agentflow): add Rich Text editor for Content Editing (FLOWISE-342)#5988

Merged
jocelynlin-wd merged 8 commits into
mainfrom
feat/agentflow-sdk-rich-text-editor
Mar 17, 2026
Merged

feat(agentflow): add Rich Text editor for Content Editing (FLOWISE-342)#5988
jocelynlin-wd merged 8 commits into
mainfrom
feat/agentflow-sdk-rich-text-editor

Conversation

@jocelynlin-wd

@jocelynlin-wd jocelynlin-wd commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add RichTextEditor atom wrapping TipTap with code block syntax highlighting (lowlight) for the agentflow SDK
  • Update ExpandTextDialog to support a richtext mode alongside plain text
  • Replace plain TextField in MessagesInput content fields with the new rich text editor
  • Lazy-load RichTextEditor via React.lazy + Suspense and import only 4 highlight.js languages (js/json/py/ts) instead of lowlight/common (~400KB bundle savings)
  • Add syntaxHighlight colors and typography constants to design tokens
  • Update ESLint rules and ARCHITECTURE.md to allow atoms → core/theme imports

Test plan

  • 39 unit tests passing across RichTextEditor, ExpandTextDialog, and MessagesInput
  • Verify TipTap editor renders correctly in the expand dialog (richtext mode)
  • Verify code block syntax highlighting works for JS, JSON, Python, TypeScript
  • Verify lazy loading — RichTextEditor chunk should not appear in initial bundle

🤖 Generated with Claude Code

Bundle size analysis

  • Impact on main entry (what consumers load upfront)
  Baseline (no TipTap) Now Delta
ES main 631 KB (166 KB gz) 633 KB (167 KB gz) +2 KB (+0.3%)

The main entry is essentially unchanged — the only addition is the React.lazy() call and Suspense wrapper.

  • Lazy chunk (loaded on demand, only when editor renders)
  Size
RichTextEditor chunk 554 KB (146 KB gz)
  • UMD (can't code-split)
  Baseline Now Delta
UMD 408 KB (135 KB gz) 762 KB (244 KB gz) +354 KB (+87%)

Summary: For ES module consumers (the common case), the upfront cost is +2 KB. TipTap + highlight.js load lazily as a 554 KB chunk only when a RichTextEditor actually renders. The UMD build takes the full hit since it can't code-split.

Recordings:

agentflow-sdk-rich-text-editor.mov
agentflow-sdk-rich-text-lang-highlights.mov
agentflow-sdk-rich-text-lazy-loaded.mov

Introduce a RichTextEditor atom wrapping TipTap with code block syntax
highlighting (lowlight). Update ExpandTextDialog to support a 'richtext'
mode and replace plain TextFields in MessagesInput with the new editor.

Lazy-load RichTextEditor via React.lazy + Suspense to keep the initial
bundle lean. Import only 4 highlight.js languages (js/json/py/ts)
instead of lowlight/common (~400KB savings).

FLOWISE-342

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new RichTextEditor component, built with TipTap, to enable rich content editing within the application. This editor, featuring code block syntax highlighting, is integrated into the MessagesInput component and the ExpandTextDialog, significantly upgrading the content input capabilities. The changes also include necessary updates to ESLint rules, architecture documentation, and Jest configurations to support the new component and its dependencies, while also optimizing bundle size by lazy-loading the editor and selectively importing syntax highlighting languages.

Highlights

  • New RichTextEditor Atom: Introduced a new RichTextEditor atom component, leveraging TipTap for rich text editing and lowlight for syntax highlighting with optimized bundle size by lazy-loading and selectively importing languages.
  • ExpandTextDialog Enhancement: The ExpandTextDialog now supports a richtext mode, allowing users to edit content using the new rich text editor.
  • MessagesInput Integration: The MessagesInput component has been updated to utilize the RichTextEditor for message content fields, enhancing the user experience.
  • Content Synchronization: Implemented latestContentRef in MessagesInput to ensure the expand dialog always displays the most up-to-date content, even with pending inline edits.
  • ESLint and Architecture Updates: Updated ESLint rules and architecture documentation to permit atoms to import design tokens from core/theme and allow autoFocus on custom components.
  • Jest Configuration for ESM: Configured Jest to mock ESM-only TipTap and lowlight modules for seamless testing.
Changelog
  • packages/agentflow/.eslintrc.js
    • Allowed autoFocus on custom components in jsx-a11y/no-autofocus rule.
    • Permitted atoms to import from core/theme in import/no-restricted-paths.
  • packages/agentflow/ARCHITECTURE.md
    • Updated documentation to reflect that atoms can import design tokens from core/theme.
  • packages/agentflow/examples/src/demos/BasicExample.tsx
    • Added a new agent node and an edge to the basic example flow.
  • packages/agentflow/jest.config.js
    • Configured Jest to mock TipTap and lowlight modules for ESM compatibility.
    • Included coverage thresholds for ExpandTextDialog.tsx, MessagesInput.tsx, and RichTextEditor.tsx.
  • packages/agentflow/package.json
    • Added TipTap and lowlight related dependencies.
  • packages/agentflow/src/mocks/@tiptap/extension-code-block-lowlight.ts
    • Added a mock for the TipTap CodeBlockLowlight extension.
  • packages/agentflow/src/mocks/@tiptap/extension-placeholder.ts
    • Added a mock for the TipTap Placeholder extension.
  • packages/agentflow/src/mocks/@tiptap/react.ts
    • Added mocks for TipTap useEditor and EditorContent hooks and components.
  • packages/agentflow/src/mocks/@tiptap/starter-kit.ts
    • Added a mock for the TipTap StarterKit extension.
  • packages/agentflow/src/mocks/lowlight.ts
    • Added mocks for lowlight library functions.
  • packages/agentflow/src/atoms/ExpandTextDialog.test.tsx
    • Added unit tests for the new richtext mode in ExpandTextDialog.
  • packages/agentflow/src/atoms/ExpandTextDialog.tsx
    • Implemented a richtext mode using a lazy-loaded RichTextEditor and updated styling.
  • packages/agentflow/src/atoms/MessagesInput.test.tsx
    • Updated unit tests to accommodate the RichTextEditor and added tests for content ref synchronization.
  • packages/agentflow/src/atoms/MessagesInput.tsx
    • Replaced TextField with RichTextEditor for message content and enhanced expand dialog content synchronization.
  • packages/agentflow/src/atoms/RichTextEditor.test.tsx
    • Added unit tests for the new RichTextEditor component.
  • packages/agentflow/src/atoms/RichTextEditor.tsx
    • Added a new RichTextEditor atom component based on TipTap with code block syntax highlighting.
  • packages/agentflow/src/atoms/index.ts
    • Exported the new RichTextEditor component.
  • packages/agentflow/src/core/theme/tokens.ts
    • Added new design tokens for syntax highlighting colors and typography.
Activity
  • The author has implemented 39 unit tests across RichTextEditor, ExpandTextDialog, and MessagesInput, ensuring core functionality.
  • The author has outlined a comprehensive test plan, including verification steps for TipTap editor rendering, syntax highlighting, disabled states, and lazy loading.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

The pull request introduces a new RichTextEditor component, built with TipTap, to provide rich text editing capabilities with syntax highlighting. This component is integrated into MessagesInput and ExpandTextDialog to replace basic text fields, improving the user experience for editing multi-line content. Supporting changes include updates to ESLint rules, architecture documentation, Jest configurations (including mocks for ESM-only TipTap/lowlight modules and new coverage thresholds), and new dependencies. The MessagesInput component now uses a latestContentRef to ensure the expanded dialog always displays the most current inline edits. Additionally, new theme tokens for syntax highlighting and typography were added to maintain consistent styling and sizing. A review comment suggests improving the RichTextEditor's autofocus mechanism by utilizing TipTap's native autofocus option instead of a potentially brittle setTimeout, or to provide justification for the current implementation.

Comment thread packages/agentflow/src/atoms/RichTextEditor.tsx Outdated
jocelynlin-wd and others added 2 commits March 16, 2026 16:30
Remove stale @types/uuid from pnpm-lock.yaml to fix frozen-lockfile
CI failure. Replace setTimeout-based autofocus with TipTap's built-in
autofocus option for more reliable focus behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Generate item keys synchronously to fix missing key prop warning
- Wrap IconVariable in span for MUI Tooltip ref forwarding
- Use :first-of-type/:last-of-type instead of :first-child/:last-child

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jocelynlin-wd

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a powerful RichTextEditor atom using TipTap, which is a significant enhancement for content editing. The implementation is very well done, with great attention to performance through lazy loading and selective language imports for syntax highlighting. The state management in MessagesInput to handle fresh content in the expand dialog is also a clever and robust solution. I have one suggestion in RichTextEditor.tsx to improve performance and clarify the behavior of props. Overall, this is an excellent contribution.

Comment thread packages/agentflow/src/atoms/RichTextEditor.tsx
jocelynlin-wd and others added 3 commits March 16, 2026 16:55
Add CSS selectors for hljs classes so lowlight syntax colors are
actually applied. Fix block spacing by targeting only the first/last
child of the editor instead of first/last-of-type per element.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jocelynlin-wd

Copy link
Copy Markdown
Contributor Author

/gemini review

@jocelynlin-wd jocelynlin-wd changed the title FLOWISE-342 Add TipTap RichTextEditor atom for content editing feat(agentflow): add Rich Textfor Content Editing (FLOWISE-342) Mar 17, 2026
@jocelynlin-wd jocelynlin-wd changed the title feat(agentflow): add Rich Textfor Content Editing (FLOWISE-342) feat(agentflow): add Rich Text editor for Content Editing (FLOWISE-342) Mar 17, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

The pull request introduces a new lazy-loaded RichTextEditor component, built with TipTap and lowlight for syntax highlighting, to enable rich text editing. This editor replaces plain text fields in the MessagesInput component and is integrated into the ExpandTextDialog for an enhanced user experience. Supporting changes include Jest mocks for TipTap, updated ESLint rules, architecture documentation, and new theme tokens for syntax highlighting. A review comment suggests improving the useMemo dependency array in RichTextEditor for better code clarity and to prevent potential bugs.

Comment thread packages/agentflow/src/atoms/RichTextEditor.tsx Outdated
@jocelynlin-wd jocelynlin-wd requested a review from j-sanaa March 17, 2026 01:24
Comment thread packages/agentflow/src/atoms/MessagesInput.tsx Outdated
Comment thread packages/agentflow/src/atoms/RichTextEditor.lazy.tsx Outdated
@jocelynlin-wd jocelynlin-wd merged commit b38a416 into main Mar 17, 2026
7 checks passed
@jocelynlin-wd jocelynlin-wd deleted the feat/agentflow-sdk-rich-text-editor branch March 19, 2026 17:39
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