-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[front] - feat: transform url in InputBar
#11389
Conversation
d20c2f5
to
b9b5e7c
Compare
…cement in input bar editor - Implement useEffect to replace URLs with node titles when search results are available - Store pending URL node replacement information for later processing when data arrives - Handle paste events for URLs and trigger node ID retrieval and storage for replacement - Add storage management for URL to node title replacements within the editor extension - Enhance URLDetectionExtension to manage detection and storage of node replacement data - Include URLReplacementStorage extension in the custom editor setup for input bar
… implement storage for URL replacements - Created an extension to keep track of pending URL replacements within the editor - Added methods to add, retrieve, and clear replacement metadata, as well as set the current node ID
- Simplify the logic by removing direct mutation of editor state and URL replacement handling - Introduce useUrlHandler hook to manage URL detection and node selection process - Adjust import references to accommodate codebase restructuring - Update plugin handling for URL detection to utilize new URLStorage model
… handle URLs in conversation editor - Automatically format and replace pending URLs with node-specific text in the conversation editor - Cleanup pending URL entries after processing to keep the storage clean
- Introduce a new tiptap extension to manage URL states within the editor - Create a storage mechanism for pending URLs with their respective metadata such as node ID and position in the editor
b9b5e7c
to
6e06ee9
Compare
…ve URLReplacementStorage extension - URLReplacementStorage extension is deleted, possibly due to its functionality being handled elsewhere or no longer needed - Associated types and methods for managing URL replacements within the editor have been removed
- Refactor URL replacement logic into a useCallback hook to optimize performance - Ensure editor commands are ready before attempting to replace the URL - Add error handling for failed URL replacements and clean up useEffect dependencies
…: improve URL insertion with node titles - Use node titles and locations for link text instead of node and space IDs - Rename useUrlHandler.ts to useUrlHandler.tsx to reflect JSX usage
} | ||
|
||
try { | ||
const formattedText = `${node.title} - ${getLocationForDataSourceViewContentNode(node)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is temporary as we want to display an icon. However at first glance it didn't seem straightforward to replace text with something else than a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
via css maybe? the same way you can green up text, you can inject images or stuff with before-content for instance
…ack signature - Removed the url parameter from onUrlDetected callback as it's no longer needed - Adjusted associated functions and components to the new callback signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 Left a few coms but pre-approving
url, | ||
nodeId, | ||
from, | ||
to: from + url.length, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the replacement takes a bit long, and the user types / deletes stuff could that result in weird behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not manage to break it locally, but will definitely keep an eye out for that 👍🏼
onUrlDetected: handleUrlDetected, | ||
}), | ||
}); | ||
|
||
useUrlHandler(editor, selectedNode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do selected node from URL and from picker play well together? is it ok to have them both with the same name in the same state var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They only share the onNodeSelect
callback. The entire picker attachment logic is handled in InputBarAttachmentsPicker
, so everything should be fine 😃
} | ||
|
||
try { | ||
const formattedText = `${node.title} - ${getLocationForDataSourceViewContentNode(node)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
via css maybe? the same way you can green up text, you can inject images or stuff with before-content for instance
* [assistant/conversation/input_bar] - feature: automate URL node replacement in input bar editor - Implement useEffect to replace URLs with node titles when search results are available - Store pending URL node replacement information for later processing when data arrives - Handle paste events for URLs and trigger node ID retrieval and storage for replacement - Add storage management for URL to node title replacements within the editor extension - Enhance URLDetectionExtension to manage detection and storage of node replacement data - Include URLReplacementStorage extension in the custom editor setup for input bar * [front/assistant/conversation/input_bar/editor/extensions] - feature: implement storage for URL replacements - Created an extension to keep track of pending URL replacements within the editor - Added methods to add, retrieve, and clear replacement metadata, as well as set the current node ID * [front] - refactor: streamline URL handling in InputBarContainer - Simplify the logic by removing direct mutation of editor state and URL replacement handling - Introduce useUrlHandler hook to manage URL detection and node selection process - Adjust import references to accommodate codebase restructuring - Update plugin handling for URL detection to utilize new URLStorage model * [front/components/assistant/conversation/input_bar/editor] - feature: handle URLs in conversation editor - Automatically format and replace pending URLs with node-specific text in the conversation editor - Cleanup pending URL entries after processing to keep the storage clean * [front] - feature: add URL storage extension to input bar editor - Introduce a new tiptap extension to manage URL states within the editor - Create a storage mechanism for pending URLs with their respective metadata such as node ID and position in the editor * [assistant/conversation/input_bar/editor/extensions] - refactor: remove URLReplacementStorage extension - URLReplacementStorage extension is deleted, possibly due to its functionality being handled elsewhere or no longer needed - Associated types and methods for managing URL replacements within the editor have been removed * [front/components/assistant] - refactor: improve URL handling in editor - Refactor URL replacement logic into a useCallback hook to optimize performance - Ensure editor commands are ready before attempting to replace the URL - Add error handling for failed URL replacements and clean up useEffect dependencies * [front/components/assistant/conversation/input_bar/editor] - refactor: improve URL insertion with node titles - Use node titles and locations for link text instead of node and space IDs - Rename useUrlHandler.ts to useUrlHandler.tsx to reflect JSX usage * [front/components/assistant] - refactor: simplify onUrlDetected callback signature - Removed the url parameter from onUrlDetected callback as it's no longer needed - Adjusted associated functions and components to the new callback signature
Description
The PR implements URL transformation in the input bar by leveraging Tiptap's extension system to detect and replace URLs with node references.
The implementation follows these key aspects:
URLStorageExtension
: Manages a non-blocking storage for pending URL transformationsURLDetectionExtension
: Handles URL detection in pasted contentnodeTitle - nodePath
(this is temporary as we want to display an icon)This follows similar patterns to the existing
MentionWithPasteExtension
, ensuring consistency in the codebase.References:
Risk
Low behind FF
Deploy Plan
Deploy front