From 29ae3005eaa40f8bb1667a14927502d2e49e75d0 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 13 Dec 2017 14:18:18 +0000 Subject: [PATCH] EventEdit: don't discard fields we don't handle and add a note about it. --- src/EventEdit.tsx | 11 ++++++++++- src/pim-types.tsx | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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 {