Skip to content

Commit

Permalink
Fix crash on drag and drop image on readOnly editable (#4617)
Browse files Browse the repository at this point in the history
* Fix crash on drag and drop image on readOnly editable

* add changeset
  • Loading branch information
imdbsd authored Oct 22, 2021
1 parent 67badb7 commit b186d3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-years-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate-react': patch
---

Fix crash on drag and drop image on readOnly editable
1 change: 1 addition & 0 deletions packages/slate-react/src/components/editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ export const Editable = (props: EditableProps) => {
onDragStart={useCallback(
(event: React.DragEvent<HTMLDivElement>) => {
if (
!readOnly &&
hasTarget(editor, event.target) &&
!isEventHandled(event, attributes.onDragStart)
) {
Expand Down

0 comments on commit b186d3e

Please sign in to comment.