diff --git a/src/EventEdit.tsx b/src/EventEdit.tsx index e066e18..3551f9f 100644 --- a/src/EventEdit.tsx +++ b/src/EventEdit.tsx @@ -106,7 +106,11 @@ class EventEdit extends React.Component { return; } - let event = new EventType(); + let event = (this.props.event) ? + this.props.event.clone() + : + new EventType() + ; event.uid = this.state.uid; event.summary = this.state.title; event.startDate = ICAL.Time.fromString(this.state.start); @@ -204,6 +208,11 @@ class EventEdit extends React.Component { secondary={true} /> + +
+ Not all types are supported at the moment. If you are editing a contact, + the unsupported types will be copied as is. +
); diff --git a/src/pim-types.tsx b/src/pim-types.tsx index bebe578..44b116a 100644 --- a/src/pim-types.tsx +++ b/src/pim-types.tsx @@ -27,6 +27,10 @@ export class EventType extends ICAL.Event { comp.addSubcomponent(this.component); return comp.toString(); } + + clone() { + return new EventType(new ICAL.Component(this.component.toJSON())); + } } export class ContactType {