Skip to content
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

[WEB-2166] chore: smoother drag experience in the document editor #5296

Merged
merged 5 commits into from
Aug 5, 2024

Conversation

aaryan610
Copy link
Collaborator

@aaryan610 aaryan610 commented Aug 5, 2024

Improvements:

  1. Made the drag handle movement smooth like butter.
  2. When a table is selected, the highlight now doesn't cause any content shift.
  3. Updated the drop-cursor color.
  4. Fixed some typos.

Media:

Before After
Screen.Recording.2024-08-05.at.13.10.07.mov
Screen.Recording.2024-08-05.at.13.07.13.mov

Plane issue: WEB-2166

Summary by CodeRabbit

  • New Features

    • Improved the drag-and-drop functionality with enhanced visuals and interaction responsiveness.
    • Updated styling for the drop cursor to align with a class-based approach for better consistency.
    • Disabled PWA features during development for improved local testing and debugging.
  • Bug Fixes

    • Fixed nomenclature issues in CSS comments for better clarity.
  • Style

    • Enhanced the appearance of the drag handle and selected nodes with new CSS properties and adjustments.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Walkthrough

The recent updates enhance the drag-and-drop functionality in the editor by modernizing the codebase through arrow function syntax, improving semantic HTML usage, and refining CSS styles. Key adjustments include converting several traditional functions to arrow functions for better scoping and readability, introducing class-based styling for the drop cursor, and enhancing the visual representation of drag handles and selected nodes, ultimately improving both functionality and aesthetics.

Changes

Files Change Summary
.../drag-drop.tsx Refactored functions to arrow syntax, changed draggable handle to a button, and improved HTML semantics and variable clarity.
.../extensions.tsx Updated dropcursor property to use a class for styling instead of direct color and width attributes.
.../drag-drop.css Enhanced .drag-handle styles, renamed .hidden to .drag-handle-hidden, added animations, and improved styles for selected nodes.
.../next.config.js Added conditional disabling of PWA features during development to enhance the local testing experience.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DragHandle
    participant EditorView
    participant Node

    User->>DragHandle: Click to drag
    DragHandle->>EditorView: Initiate drag
    EditorView->>Node: Update position
    Node->>EditorView: Confirm position update
    EditorView->>User: Show updated layout
Loading

Poem

🐇 In code we hop, with joy we play,
Refactoring brings a brighter day!
With handles drag and styles so neat,
Our editor dances, oh what a treat!
Semantic paths we now explore,
A bunny's cheer for functions galore!
🥕✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 34820ee and bed3431.

Files ignored due to path filters (1)
  • web/public/sw.js.map is excluded by !**/*.map
Files selected for processing (3)
  • packages/editor/src/core/extensions/drag-drop.tsx (13 hunks)
  • packages/editor/src/core/extensions/extensions.tsx (1 hunks)
  • packages/editor/src/styles/drag-drop.css (5 hunks)
Additional comments not posted (15)
packages/editor/src/styles/drag-drop.css (7)

6-7: LGTM! Improved drag handle styling.

The increased width, added aspect-ratio, and consolidated transition properties enhance the visual and interactive aspects of the drag handle.

Also applies to: 13-18


29-29: LGTM! Improved class naming.

The class name change from .hidden to .drag-handle-hidden improves clarity regarding its purpose.


71-88: LGTM! Enhanced selected node styling.

The addition of the --horizontal-offset variable and modifications to the ::after pseudo-element provide a more dynamic and visually appealing representation of selected nodes.


91-91: LGTM! Improved task list item styling.

The changes targeting ProseMirror-selectednode with data-checked attribute improve the visual representation of selected task list items.


96-96: LGTM! Improved unordered list item styling.

The changes targeting ProseMirror-selectednode in unordered lists improve the visual representation of selected unordered list items.


106-117: LGTM! Improved ordered list item styling.

The changes targeting ProseMirror-selectednode in ordered lists and adjusting margins for items after the 9th and 99th improve the visual representation of selected ordered list items.


117-117: LGTM! Enhanced image styling.

The changes adding transition and hover effects for images enhance the visual feedback when interacting with images.

packages/editor/src/core/extensions/extensions.tsx (1)

76-76: LGTM! Improved drop cursor styling.

The change to use a class attribute for the dropcursor property ties the styling to a CSS framework or custom styling rules, improving maintainability and consistency.

packages/editor/src/core/extensions/drag-drop.tsx (7)

Line range hint 31-54:
LGTM! Improved function syntax and semantic meaning.

The refactoring to arrow function syntax and updates to HTML elements for semantic meaning improve consistency, readability, and semantic meaning of the code.


56-64: LGTM! Improved function syntax.

The refactoring to arrow function syntax improves consistency and readability of the code.


Line range hint 66-99:
LGTM! Improved function syntax.

The refactoring to arrow function syntax improves consistency and readability of the code.


101-108: LGTM! Improved function syntax.

The refactoring to arrow function syntax improves consistency and readability of the code.


110-117: LGTM! Improved function syntax.

The refactoring to arrow function syntax improves consistency and readability of the code.


Line range hint 119-133:
LGTM! Improved function syntax.

The refactoring to arrow function syntax improves consistency and readability of the code.


Line range hint 135-404:
LGTM! Improved function syntax and event handling.

The refactoring to arrow function syntax improves consistency and readability of the code. The event handling logic remains intact and clear.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bed3431 and 33927b9.

Files selected for processing (1)
  • web/next.config.js (1 hunks)
Additional comments not posted (1)
web/next.config.js (1)

9-9: LGTM! Disabling PWA in development mode is a good practice.

The addition of the disable property to the next-pwa configuration ensures that PWA features are disabled during development, which can help avoid potential issues with local testing and debugging.

@sriramveeraghanta sriramveeraghanta merged commit f9e7a58 into preview Aug 5, 2024
11 of 14 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore/smoother-drag-experience branch August 5, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants