fix: Drag drop handle's behavior fixed on mouse leave #3401
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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? 馃
hideDragHandle
prop toEditorContainer
component ineditor-container.tsx
.onMouseLeave
event handler inEditorContainer
to invokehideDragHandle
function that the Drag-Drop plugin exposes.DragAndDrop
extension indrag-drop.tsx
to accept asetHideDragHandle
function as an optional parameter.setHideDragHandle
function fromRichTextEditor
component toDragAndDrop
extension inRichTextEditorExtensions
function inindex.tsx
.hideDragHandleOnMouseLeave
state inRichTextEditor
component to store thehideDragHandlerFromDragDrop
function.setHideDragHandleFunction
callback function inRichTextEditor
to update thehideDragHandleOnMouseLeave
state.hideDragHandleOnMouseLeave
ashideDragHandle
prop toEditorContainer
component inRichTextEditor
.The Result 馃槍
Before
before.mov
After
after.mov