-
Notifications
You must be signed in to change notification settings - Fork 125
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] - chore(InputBar): prettified url pasting #11416
Conversation
…ource link components for the editor - Added 'DataSourceLinkComponent' to render data source links with icons in the input bar editor - Implemented 'DataSourceLinkExtension' for tiptap editor, enabling inline data source linking within text editor
…urceLinkExtension into custom editor - Added DataSourceLinkExtension to the list of extensions in useCustomEditor to handle data source links - Simplified useUrlHandler hook to directly insert dataSourceLink nodes upon selection of a node
- Simplified the markup of DataSourceLinkComponent for clarity - Adjusted Chip component usage with icon and smaller size "xs"
- Ensure compatibility with the latest features and bug fixes in the @dust-tt/sparkle library - Maintain integrity and stable functionality within the project dependencies
…itor hook - Remove duplicate DataSourceLinkExtension import in useCustomEditor.tsx - Add a missing dependency to useEffect in OAuth finalize page [front/components] - style: add whitespace for better readability in extensions - Insert a blank line for visual separation in DataSourceLinkExtension.ts and useUrlHandler.tsx
…ip text is readable - Added `color="white"` to `Chip` component to improve text visibility against varying backgrounds
6d76009
to
6a7a8b6
Compare
Note: the last step will be to add wrapping whitespaces where needed. |
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 :) a few questions:
- is there a way for the user to go back to the URL?
- is the URL still rendered when the message is submitted? (notably mentioned to the model)
Second point is quite important, here we want to make sure the model has a message in which what it sees is consistent with what is attached. So I would say don't render the URL, render the doc's title + maybe content fragment id in some way)
Also, in general for UX-related PRs, screenshots in the description go a long way
@philipperolet Lemme know what you think would be nice here and I'll update it. |
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.
LGTM; ccing @Duncid @pinotalexandre for chip / mention design => how do we want the "pasted url" to look once recognized as one of our knowledge?
As for the ability to remove the mention and get back to a url, I think we can skip --- very edge casy IMO, wdyt design?
Or, we could turn the mention back to an url if the user deletes the related attachment?
here is the current design @Duncid @pinotalexandre |
@JulesBelveze I think we can remove the Google Drive Icon given that it is in the top bar attachement. Will make it look better. |
"Bug" spotted : |
If deleting the attachements and then repasting the link, the attachement is not displayed anymore |
…: simplify DataSourceLinkComponent - Remove provider-specific icon from DataSourceLink chip display - Rely on default Chip component styling without custom icons
Description
This PR implements a custom node extension for rendering data source links in the input bar editor. When a user pastes a URL that corresponds to a data source node, the URL is transformed into a
Chip
component.The solution leverages Tiptap's
ReactNodeViewRenderer
to bridge ProseMirror's document model with React components. This allows us to maintain proper document structure.Created a custom node extension (
DataSourceLinkExtension
) that defines how data source links are represented in the editor document modelImplemented a React component (
DataSourceLinkComponent
) that renders the data source linkChip
component for consistent UIUpdated URL handler logic to transform detected URLs into data source link nodes
This implementation follows the same pattern used for mentions in the editor, ensuring consistency across the codebase. The custom node approach provides better semantics, styling control, and future extensibility compared to plain text replacement.
Risk
Low, behind FF
Deploy Plan
Deploy front