From 8fd63298322ba506823f3c44eadd8820c2bf684b Mon Sep 17 00:00:00 2001 From: ismajl-polymath <58982369+ismajl-polymath@users.noreply.github.com> Date: Thu, 8 Oct 2020 16:40:13 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20item=20preview=20inside=20cell=20while?= =?UTF-8?q?=20dragging=20from=20outside=20not=20working=E2=80=A6=20(#1770)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: item preview inside cell while dragging from outside not working properly * switched moveEvent, newEvent to arrow functions inside dnd from outside exmaple Co-authored-by: ismajlramadani --- examples/demos/dndOutsideSource.js | 4 ++-- src/addons/dragAndDrop/WeekWrapper.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/demos/dndOutsideSource.js b/examples/demos/dndOutsideSource.js index 979b5b9c5..0c130653e 100644 --- a/examples/demos/dndOutsideSource.js +++ b/examples/demos/dndOutsideSource.js @@ -67,7 +67,7 @@ class Dnd extends React.Component { this.newEvent(event) } - moveEvent({ event, start, end, isAllDay: droppedOnAllDaySlot }) { + moveEvent = ({ event, start, end, isAllDay: droppedOnAllDaySlot }) => { const { events } = this.state const idx = events.indexOf(event) @@ -107,7 +107,7 @@ class Dnd extends React.Component { //alert(`${event.title} was resized to ${start}-${end}`) } - newEvent(event) { + newEvent = event => { let idList = this.state.events.map(a => a.id) let newId = Math.max(...idList) + 1 let hour = { diff --git a/src/addons/dragAndDrop/WeekWrapper.js b/src/addons/dragAndDrop/WeekWrapper.js index c829255c8..51ab6b109 100644 --- a/src/addons/dragAndDrop/WeekWrapper.js +++ b/src/addons/dragAndDrop/WeekWrapper.js @@ -80,7 +80,7 @@ class WeekWrapper extends React.Component { } handleMove = ({ x, y }, node, draggedEvent) => { - const { event = draggedEvent } = this.context.draggable.dragAndDropAction + const event = this.context.draggable.dragAndDropAction.event || draggedEvent const metrics = this.props.slotMetrics const { accessors } = this.props