Skip to content

fix: some toolbar link launch review issues#7639

Merged
LucasXu0 merged 9 commits intoAppFlowy-IO:mainfrom
asjqkkkk:fix/toolbar/link
Mar 31, 2025
Merged

fix: some toolbar link launch review issues#7639
LucasXu0 merged 9 commits intoAppFlowy-IO:mainfrom
asjqkkkk:fix/toolbar/link

Conversation

@asjqkkkk
Copy link
Copy Markdown
Collaborator

@asjqkkkk asjqkkkk commented Mar 27, 2025

Fix:

  • Dark mode issues with link buttons
  • Display “Untitled” when the pate name is empty
  • Icon and name are not vertically centered
  • Show the toast after copy the link
  • Show the page name instead of the link while hovering on a page link
  • Hide the toolbar after create a link
  • Support link validator

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Improve link-related functionality and user experience in the document editor toolbar, addressing various UI and interaction issues

Bug Fixes:

  • Fix dark mode styling issues with link buttons
  • Ensure page links display 'Untitled' when the page name is empty
  • Vertically center icons and names in link displays
  • Add URL validation for link creation and editing
  • Show toast notification after copying a link

Enhancements:

  • Improve link hover menu to show page details
  • Add dynamic page name and icon display for internal links
  • Enhance link creation and editing interactions
  • Improve toolbar button states and color handling

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Mar 27, 2025

Reviewer's Guide by Sourcery

This pull request addresses several issues related to link handling in the AppFlowy editor. It fixes dark mode issues with link buttons, displays 'Untitled' when a page name is empty, shows a toast after copying a link, displays the page name instead of the link while hovering, validates URLs, and hides the toolbar after creating a link. It also disables toolbar animation.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Improved the link hover menu to display the page name instead of the link when hovering over a page link, and to show a loading indicator when the page information is being fetched.
  • Added state management to the LinkHoverMenu to handle asynchronous loading of page view data.
  • Implemented getPageView to fetch page view data based on the link's href.
  • Added a loading indicator while fetching page view data.
  • Modified the link display to show the page name when available, defaulting to 'Untitled' if the name is empty.
  • Added logic to build the icon for the link based on the view's icon data.
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/desktop_toolbar/link/link_hover_menu.dart
Enhanced the link editing and creation menus to validate URLs and display user-friendly names for page links.
  • Added URL validation to the link editing and creation menus using the string_validator package.
  • Modified the link editing menu to display the page name instead of the link when editing a page link.
  • Updated the link search text field to display a default 'Untitled' name if the page name is empty.
  • Adjusted the UI of the link editing menu for better alignment and appearance.
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/desktop_toolbar/link/link_edit_menu.dart
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/desktop_toolbar/link/link_search_text_field.dart
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/desktop_toolbar/link/link_create_menu.dart
Addressed dark mode issues with link buttons and toolbar items by adjusting icon colors and styles based on the current theme.
  • Modified the link toolbar item to use theme-aware icon colors.
  • Updated the format toolbar item to handle dark mode styling.
  • Adjusted the highlight color and text color toolbar items to use theme-aware icon colors.
  • Modified the link edit menu to adjust the font color based on the theme.
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toolbar_item/custom_link_toolbar_item.dart
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toolbar_item/custom_format_toolbar_items.dart
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toolbar_item/custom_hightlight_color_toolbar_item.dart
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toolbar_item/custom_text_color_toolbar_item.dart
Implemented a toast notification after copying a link and hid the toolbar after creating a link.
  • Added a toast notification to confirm when a link has been copied.
  • Updated the link creation menu to hide the toolbar after a link is created.
  • Updated the link creation menu to update the editor selection after a link is created.
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/desktop_toolbar/link/link_hover_menu.dart
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/desktop_toolbar/link/link_create_menu.dart
Disabled toolbar animation.
  • Disabled toolbar animation.
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @asjqkkkk - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using constants for magic numbers like 320 and 48 in LinkHoverMenu to improve readability.
  • The isSelectionSame method in HoverTriggerKey could be simplified to selection.start == other.start && selection.end == other.end.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@LucasXu0 LucasXu0 merged commit 5e1a8b1 into AppFlowy-IO:main Mar 31, 2025
18 checks passed
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