1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 20:40:19 +02:00

Fix crash on drag and drop image on readOnly editable (#4617)

* Fix crash on drag and drop image on readOnly editable

* add changeset
This commit is contained in:
I Made Budi Surya Darma
2021-10-22 21:39:30 +08:00
committed by GitHub
parent 67badb7dd0
commit b186d3ea12
2 changed files with 6 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
'slate-react': patch
---
Fix crash on drag and drop image on readOnly editable

View File

@@ -884,6 +884,7 @@ export const Editable = (props: EditableProps) => {
onDragStart={useCallback( onDragStart={useCallback(
(event: React.DragEvent<HTMLDivElement>) => { (event: React.DragEvent<HTMLDivElement>) => {
if ( if (
!readOnly &&
hasTarget(editor, event.target) && hasTarget(editor, event.target) &&
!isEventHandled(event, attributes.onDragStart) !isEventHandled(event, attributes.onDragStart)
) { ) {