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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Drag drop handle's behavior fixed on mouse leave #3401

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

Palanikannan1437
Copy link
Collaborator

@Palanikannan1437 Palanikannan1437 commented Jan 18, 2024

The What? 馃

This fix adds support for hiding the drag handle when the cursor leaves the editor container by figuring out a way to communicate between the Drag-Drop Plugin's native methods and our web app.

The Why? 馃え

It improves the user experience by providing a cleaner interface and removing unnecessary visual elements especially while scrolling when the drag handle is visible at the wrong places even when your cursor is out of the container.

The How? 馃

  • Added hideDragHandle prop to EditorContainer component in editor-container.tsx.
  • Implemented onMouseLeave event handler in EditorContainer to invoke hideDragHandle function that the Drag-Drop plugin exposes.
  • Updated DragAndDrop extension in drag-drop.tsx to accept a setHideDragHandle function as an optional parameter.
  • Pass the setHideDragHandle function from RichTextEditor component to DragAndDrop extension in RichTextEditorExtensions function in index.tsx.
  • Set hideDragHandleOnMouseLeave state in RichTextEditor component to store the hideDragHandlerFromDragDrop function.
  • Create setHideDragHandleFunction callback function in RichTextEditor to update the hideDragHandleOnMouseLeave state.
  • Pass hideDragHandleOnMouseLeave as hideDragHandle prop to EditorContainer component in RichTextEditor.

The Result 馃槍

Before

before.mov

After

after.mov

This fix adds support for hiding the drag handle when the cursor leaves the editor container. It improves the user experience by providing a cleaner interface and removing unnecessary visual elements especially while scrolling.

- Add `hideDragHandle` prop to `EditorContainer` component in `editor-container.tsx`.
- Implement `onMouseLeave` event handler in `EditorContainer` to invoke `hideDragHandle` function.
- Update `DragAndDrop` extension in `drag-drop.tsx` to accept a `setHideDragHandle` function as an optional parameter.
- Pass the `setHideDragHandle` function from `RichTextEditor` component to `DragAndDrop` extension in `RichTextEditorExtensions` function in `index.tsx`.
- Set `hideDragHandleOnMouseLeave` state in `RichTextEditor` component to store the `hideDragHandlerFromDragDrop` function.
- Create `setHideDragHandleFunction` callback function in `RichTextEditor` to update the `hideDragHandleOnMouseLeave` state.
- Pass `hideDragHandleOnMouseLeave` as `hideDragHandle` prop to `EditorContainer` component in `RichTextEditor`.
@Palanikannan1437 Palanikannan1437 self-assigned this Jan 18, 2024
@Palanikannan1437 Palanikannan1437 changed the title [fixDrag drop mouse leave fix: Drag drop handle's behavior fixed on mouse leave Jan 18, 2024
@sriramveeraghanta sriramveeraghanta merged commit 75b8e33 into develop Jan 18, 2024
6 of 8 checks passed
@sriramveeraghanta sriramveeraghanta deleted the drag-drop-mouse-leave branch January 18, 2024 07:13
@sriramveeraghanta sriramveeraghanta added this to the v0.15-dev milestone Jan 18, 2024
sriramveeraghanta pushed a commit that referenced this pull request Jan 22, 2024
This fix adds support for hiding the drag handle when the cursor leaves the editor container. It improves the user experience by providing a cleaner interface and removing unnecessary visual elements especially while scrolling.

- Add `hideDragHandle` prop to `EditorContainer` component in `editor-container.tsx`.
- Implement `onMouseLeave` event handler in `EditorContainer` to invoke `hideDragHandle` function.
- Update `DragAndDrop` extension in `drag-drop.tsx` to accept a `setHideDragHandle` function as an optional parameter.
- Pass the `setHideDragHandle` function from `RichTextEditor` component to `DragAndDrop` extension in `RichTextEditorExtensions` function in `index.tsx`.
- Set `hideDragHandleOnMouseLeave` state in `RichTextEditor` component to store the `hideDragHandlerFromDragDrop` function.
- Create `setHideDragHandleFunction` callback function in `RichTextEditor` to update the `hideDragHandleOnMouseLeave` state.
- Pass `hideDragHandleOnMouseLeave` as `hideDragHandle` prop to `EditorContainer` component in `RichTextEditor`.
sriramveeraghanta pushed a commit that referenced this pull request Jan 22, 2024
This fix adds support for hiding the drag handle when the cursor leaves the editor container. It improves the user experience by providing a cleaner interface and removing unnecessary visual elements especially while scrolling.

- Add `hideDragHandle` prop to `EditorContainer` component in `editor-container.tsx`.
- Implement `onMouseLeave` event handler in `EditorContainer` to invoke `hideDragHandle` function.
- Update `DragAndDrop` extension in `drag-drop.tsx` to accept a `setHideDragHandle` function as an optional parameter.
- Pass the `setHideDragHandle` function from `RichTextEditor` component to `DragAndDrop` extension in `RichTextEditorExtensions` function in `index.tsx`.
- Set `hideDragHandleOnMouseLeave` state in `RichTextEditor` component to store the `hideDragHandlerFromDragDrop` function.
- Create `setHideDragHandleFunction` callback function in `RichTextEditor` to update the `hideDragHandleOnMouseLeave` state.
- Pass `hideDragHandleOnMouseLeave` as `hideDragHandle` prop to `EditorContainer` component in `RichTextEditor`.
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.

None yet

2 participants