Skip to content

Conversation

@DebottamMandal123
Copy link
Contributor

Added a custom PasteRule and renderText override to the Tiptap Mention extension. It ensures variables like {{variable}} are correctly converted into Mention nodes on paste and copied with the correct closing braces.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @DebottamMandal123, 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 addresses a critical issue in Agentflow V2 where variable syntax highlighting was lost when content containing variables like {{variable}} was copied and pasted from external editors. The solution involves extending the Tiptap Mention extension to intelligently parse and reformat these variables upon pasting, ensuring they retain their intended visual and functional properties within the editor.

Highlights

  • Improved Variable Handling on Paste: Implemented a custom Tiptap PasteRule to correctly convert {{variable}} syntax into Mention nodes when content is pasted into the rich text editor, ensuring proper formatting and functionality.
  • Correct Variable Rendering: Overrode the renderText method for the Tiptap Mention extension to ensure that variables are consistently displayed with the {{variable}} format, addressing issues where closing braces might be lost.
  • Enhanced User Experience: These changes prevent the loss of variable syntax highlighting and structure, providing a more robust and predictable editing experience for users in Agentflow V2.
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
Copy link
Contributor

Summary of Changes

Hello @DebottamMandal123, 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 resolves an issue in Agentflow V2 where variable syntax highlighting was lost when content containing variables, such as {{variable}}, was copy-pasted from external editors. The changes enhance the Tiptap rich text editor's functionality by introducing a custom Mention extension that correctly parses and renders these variables as structured nodes upon pasting, thereby maintaining their intended highlighting and interactive behavior.

Highlights

  • Custom Tiptap Mention Extension: A new CustomMention Tiptap extension has been introduced, extending the base Mention extension to provide specialized handling for variables.
  • Variable Rendering Override: The renderText method within the CustomMention extension has been overridden to ensure that variables are consistently rendered with the {{variable}} syntax, preserving their visual representation.
  • Paste Rule for Variables: A PasteRule has been added to CustomMention that automatically detects and converts text matching the {{variable}} pattern into proper Tiptap Mention nodes when pasted into the editor. This ensures that variables retain their syntax highlighting and functionality even after being copied from external sources.
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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 effectively resolves the issue of variable syntax highlighting being lost on copy-paste by creating a custom Tiptap Mention extension. The implementation with renderText and addPasteRules is well done. However, the new CustomMention extension is duplicated in both ExpandRichInputDialog.jsx and RichInput.jsx. To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, this duplicated code should be extracted into a single, reusable module.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 CustomMention Tiptap extension to fix an issue with copy-pasting variables. The approach of using renderText and addPasteRules is correct and effectively solves the problem.

My main feedback is regarding code duplication. The CustomMention component is defined identically in two separate files (ExpandRichInputDialog.jsx and RichInput.jsx). I've left comments suggesting to extract this logic into a shared module to improve maintainability. Addressing this will make the codebase cleaner and easier to manage in the long run.

Copy link
Contributor

@HenryHengZJ HenryHengZJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow this is awesome thank you!

@HenryHengZJ HenryHengZJ merged commit da32fc7 into FlowiseAI:main Nov 26, 2025
2 checks passed
@DebottamMandal123 DebottamMandal123 deleted the bugfix/variable-syntax-highlighting branch November 26, 2025 07:38
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.

Variable syntax highlighting lost after copy-paste from external editor in Agentflow V2

2 participants