calendar fix contd
This commit was merged in pull request #11.
This commit is contained in:
@@ -39,37 +39,22 @@ export default function EventCalendar({draggedEvent, setDraggedEvent}) {
|
||||
}
|
||||
}
|
||||
|
||||
// const onDrop = useCallback(
|
||||
// (event) => {
|
||||
// // if (draggedEvent === 'undroppable') {
|
||||
// // setDraggedEvent(null)
|
||||
// // return
|
||||
// // }
|
||||
|
||||
// // let calendarApi;
|
||||
|
||||
// // calendarApi.unselect(); // clear date selection
|
||||
|
||||
// // calendarApi.addEvent({
|
||||
// // id: createEventId(),
|
||||
// // allDay: selectInfo.allDay,
|
||||
// // end: selectInfo.endStr,
|
||||
// // start: selectInfo.startStr,
|
||||
// // title,
|
||||
// // ...draggedEvent
|
||||
// // });
|
||||
|
||||
// // setDraggedEvent(null)
|
||||
// console.log('EVENT', event)
|
||||
// },
|
||||
// [draggedEvent]
|
||||
// )
|
||||
|
||||
const onDrop =
|
||||
(dropInfo) => {
|
||||
console.log('dropInfo', dropInfo)
|
||||
const onDrop = (event) => {
|
||||
console.log('event', event)
|
||||
if(event){
|
||||
let newEvent = {
|
||||
id: createEventId(),
|
||||
title: event.draggedEl.innerText,
|
||||
start: event.startStr,
|
||||
end: event.endStr,
|
||||
allDay: event.allDay,
|
||||
...event
|
||||
}
|
||||
setCurrentEvents(prev => ([...prev, newEvent]))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleEventClick(clickInfo) {
|
||||
if (
|
||||
confirm(
|
||||
@@ -112,9 +97,9 @@ export default function EventCalendar({draggedEvent, setDraggedEvent}) {
|
||||
eventRemove={function(){}}
|
||||
*/
|
||||
|
||||
dropAccept= '.fc-event'
|
||||
|
||||
droppable= {true} // this allows things to be dropped onto the calendar
|
||||
drop= {onDrop}
|
||||
drop={onDrop}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user