File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -287,10 +287,25 @@ const Calendar = ({
287287 } else if ( draggedEvent . current && cursorTime . current ) {
288288 console . debug ( 'Dropped event' , draggedEvent . current , cursorTime . current )
289289
290- saveEvent ( {
291- id : draggedEvent . current . id ,
292- start : Math . floor ( cursorTime . current . getTime ( ) / 1000 ) ,
293- } )
290+ // handle control key for copying events
291+ if ( e . ctrlKey ) {
292+ console . log ( 'Copying event' , draggedEvent . current )
293+ saveEvent ( {
294+ id : null ,
295+ is_empty_event : true ,
296+ start : Math . floor ( cursorTime . current . getTime ( ) / 1000 ) ,
297+ // TODO: copy metadata based on channel config
298+ title : draggedEvent . current . title ,
299+ subtitle : draggedEvent . current . subtitle ,
300+ duration : draggedEvent . current . duration ,
301+ color : draggedEvent . current . color ,
302+ } )
303+ } else {
304+ saveEvent ( {
305+ id : draggedEvent . current . id ,
306+ start : Math . floor ( cursorTime . current . getTime ( ) / 1000 ) ,
307+ } )
308+ }
294309 }
295310
296311 draggedEvent . current = null
Original file line number Diff line number Diff line change @@ -94,12 +94,18 @@ const Scheduler = ({ draggedObjects }) => {
9494 // and trigger a dialog to fill in the metadata
9595 const title = `Edit event: ${ event . title || 'Untitled' } `
9696 const fields = [ { name : 'start' } , ...channelConfig . fields ]
97+ const initialData = { }
98+ for ( const field of fields ) {
99+ const key = field . name
100+ if ( event [ key ] !== undefined ) initialData [ key ] = event [ key ]
101+ }
97102 try {
98103 const r = await showDialog ( 'metadata' , title , {
99104 fields,
100- initialData : { start : event . start } ,
105+ initialData,
101106 } )
102107 payload . meta = r
108+ if ( r . start ) payload . start = r . start
103109 } catch ( e ) {
104110 return
105111 }
You can’t perform that action at this time.
0 commit comments