diff --git a/docs-site/src/examples/changeDropdownLabels.jsx b/docs-site/src/examples/changeDropdownLabels.jsx index 4dd8fd0..5ba5466 100644 --- a/docs-site/src/examples/changeDropdownLabels.jsx +++ b/docs-site/src/examples/changeDropdownLabels.jsx @@ -15,6 +15,7 @@ export default React.createClass({ let items = [ { outlook: 'Outlook' }, + { outlookcom: 'Outlook.com' }, { apple: 'iCal' }, { yahoo: 'Yahoo!' }, { google: 'Google' } @@ -28,6 +29,8 @@ export default React.createClass({     {"\{ outlook: 'Outlook' \}"}
    + {"\{ outlookcom: 'Outlook.com' \}"}
+     {"\{ apple: 'iCal' \}"}
    {"\{ yahoo: 'Yahoo!' \}"}
diff --git a/docs-site/src/examples/changeDropdownOrder.jsx b/docs-site/src/examples/changeDropdownOrder.jsx index 15ba6ff..981d56d 100644 --- a/docs-site/src/examples/changeDropdownOrder.jsx +++ b/docs-site/src/examples/changeDropdownOrder.jsx @@ -15,6 +15,7 @@ export default React.createClass({ let items = [ { outlook: 'Outlook' }, + { outlookcom: 'Outlook.com' }, { apple: 'Apple Calendar' }, { yahoo: 'Yahoo' }, { google: 'Google' } @@ -28,6 +29,8 @@ export default React.createClass({     {"\{ outlook: 'Outlook' \}"}
    + {"\{ outlookcom: 'Outlook.com' \}"}
+     {"\{ apple: 'Apple Calendar' \}"}
    {"\{ yahoo: 'Yahoo' \}"}
diff --git a/docs/ReactAddToCalendar.md b/docs/ReactAddToCalendar.md index 02a977c..1e46a3e 100644 --- a/docs/ReactAddToCalendar.md +++ b/docs/ReactAddToCalendar.md @@ -67,6 +67,7 @@ defaultValue: `[ { apple: 'Apple Calendar' }, { google: 'Google' }, { outlook: 'Outlook' }, + { outlookcom: 'Outlook.com' }, { yahoo: 'Yahoo' } ]` diff --git a/src/ReactAddToCalendar.js b/src/ReactAddToCalendar.js index ce1ccfc..5c7b01c 100644 --- a/src/ReactAddToCalendar.js +++ b/src/ReactAddToCalendar.js @@ -62,7 +62,7 @@ export default class ReactAddToCalendar extends React.Component { let icon = null; if (self.props.displayItemIcons) { - let currentIcon = (currentItem === 'outlook') ? 'windows' : currentItem; + let currentIcon = (currentItem === 'outlook' || currentItem === 'outlookcom') ? 'windows' : currentItem; icon = ; } @@ -187,7 +187,8 @@ ReactAddToCalendar.defaultProps = { { apple: 'Apple Calendar' }, { google: 'Google' }, { outlook: 'Outlook' }, - { yahoo: 'Yahoo' } + { outlookcom: 'Outlook.com' }, + { yahoo: 'Yahoo' }, ], rootClass: 'react-add-to-calendar' }; \ No newline at end of file diff --git a/src/helpers/index.js b/src/helpers/index.js index 47b8919..0767b29 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -46,13 +46,25 @@ export default class helpers { // yahoo doesn't utilize endTime so we need to calulate duration let duration = this.calculateDuration(event.startTime, event.endTime); calendarUrl = 'https://calendar.yahoo.com/?v=60&view=d&type=20'; - calendarUrl += '&title=' + event.title; + calendarUrl += '&title=' + encodeURIComponent(event.title); calendarUrl += '&st=' + this.formatTime(event.startTime); calendarUrl += '&dur=' + duration; - calendarUrl += '&desc=' + event.description; + calendarUrl += '&desc=' + encodeURIComponent(event.description); calendarUrl += '&in_loc=' + encodeURIComponent(event.location); break; + case 'outlookcom': + calendarUrl = "https://outlook.live.com/owa/?rru=addevent"; + calendarUrl += "&startdt=" + this.formatTime(event.startTime); + calendarUrl += "&enddt=" + this.formatTime(event.endTime); + calendarUrl += "&subject=" + encodeURIComponent(event.title); + calendarUrl += "&location=" + encodeURIComponent(event.location); + calendarUrl += "&body=" + encodeURIComponent(event.description); + calendarUrl += "&allday=false"; + calendarUrl += "&uid=" + this.getRandomKey(); + calendarUrl += "&path=/calendar/view/Month"; + break; + default: calendarUrl = [ 'BEGIN:VCALENDAR',