From 0408a4aba04b81b2112c54d706c7d03d3579c8d5 Mon Sep 17 00:00:00 2001 From: imdbsd Date: Fri, 22 Oct 2021 14:50:17 +0800 Subject: [PATCH 1/2] Fix crash on drag and drop image on readOnly editable --- packages/slate-react/src/components/editable.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index 5575f7d088..2df1ec4bbb 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -884,6 +884,7 @@ export const Editable = (props: EditableProps) => { onDragStart={useCallback( (event: React.DragEvent) => { if ( + !readOnly && hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDragStart) ) { From f3fedb9107568f961ea015466a82d029e621ba4b Mon Sep 17 00:00:00 2001 From: imdbsd Date: Fri, 22 Oct 2021 15:03:58 +0800 Subject: [PATCH 2/2] add changeset --- .changeset/stale-years-sip.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/stale-years-sip.md diff --git a/.changeset/stale-years-sip.md b/.changeset/stale-years-sip.md new file mode 100644 index 0000000000..939a03507a --- /dev/null +++ b/.changeset/stale-years-sip.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Fix crash on drag and drop image on readOnly editable