I would like to implement CTRL + Drag & Drop
in FullCalendar v5 using PURE JavaScript only.
I did my reseach on topic and found that this was discussed as a new feature UI request on FC github. There are few suggestions how to do that, even working ones.
You can use eventDrop to create this feature. jsEvent has a ctrlKey
on which you can test. Copy the event, received as a parameter, in a new variable.
revertFunc to make go back, and then apply renderEvent with the new variable created.
chris-verclytte posted on Apr 11, 2016 does nothing for me
If it can help, here is a little trick I use waiting for this new feature to be integrated.
In eventDrop callback
// If no alt key pressed we move the event, else we duplicate it
if (!jsEvent.altKey) {
// Handle drag'n'drop copy
} else {
// Handle drag'n'drop duplication
// Here I add the event to event source
_addEventToSelectedSource(event.start, event.end);
// "Disable" the default behavior using revertFunc to avoid event moving
revertFunc();
}
The only problem with this is that the copied event disappears during drag'n'drop due to https://github.com/fullcalendar/fullcalendar/blob/master/src/common/Grid.events.js#L273
I like the best solution by AllyMurray posted on Jul 13, 2018
For anyone that comes across this issue, I have created a solution that should give you a starting point to work from. It uses the same approach as external events and leaves the original event in place.
https://stackoverflow.com/a/51327702/3891834
https://codepen.io/ally-murray/full/JBdaBV/
But I do not know how to implement this solution in pure javascript.
Could anyone help? I prefer the copy to work the way that CTRL press means copy so the original event stays in original position.