Closed choidabom closed 1 month ago
The changes involve the introduction of a new useToolBar
hook for managing the state of a formatting toolbar in a text editor, refactoring the Editor
component to utilize this hook. Additionally, a new utility for hyperlink insertion has been created, allowing users to easily link selected text to URLs. These modifications enhance the overall functionality and structure of the codebase.
Files | Change Summary |
---|---|
frontend/src/components/editor/Editor.tsx |
Refactored to use useToolBar for toolbar state management; removed unused imports. |
frontend/src/hooks/useToolBar.ts |
Introduced a new hook for managing toolbar visibility and selected formats. |
frontend/src/hooks/useFormatUtils.ts |
Added checkAndAddFormat function to conditionally modify format sets based on text selection. |
frontend/src/utils/urlHyperlinkInserter.ts |
Added functionality for inserting hyperlinks into the editor based on pasted URLs. |
frontend/package.json |
Added dependencies for validator and @types/validator to support hyperlink functionality. |
Objective | Addressed | Explanation |
---|---|---|
Add hyperlink creation feature (#322) | β |
π° Hopping through the code so bright,
A toolbar that dances, oh what a sight!
Links now can flourish with just a quick paste,
Formatting made easy, no time to waste!
In the editor's garden, we play and we cheer,
With each little change, the magic draws near! π
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
What this PR does / why we need it?
This PR introduces a feature that enhances text selection by enabling the automatic creation of hyperlinks when dragging and selecting text prior to pasting a link. Currently, users experience the inconvenience of having URLs pasted directly into the text instead of being applied as hyperlinks to the selected text.
With this enhancement, the system will automatically detect if the copied content is a link and generate a Markdown link format that connects the selected text with the URL, thus improving the overall user experience.
Any background context you want to provide?
Streamlining the hyperlink creation process will not only save time for users but also ensure that linking text is more intuitive. This is particularly useful for users who frequently need to reference external sources, as they can now create clickable links with a simple drag-and-select action, enhancing productivity and usability.
What are the relevant tickets?
Fixes https://github.com/yorkie-team/codepair/issues/322
Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Chores