mirror of
https://github.com/outline/outline.git
synced 2026-03-03 01:30:06 -06:00
Squashed commit of the following:
commit ebe2fe07d1a9110a99a21772b79f189dd13b4ca8 Author: Tom Moor <tom.moor@gmail.com> Date: Thu Aug 26 20:18:52 2021 -0700 fix: regex, formatting commit1fd17b6f8aAuthor: Matheus Breguêz <matbrgz@gmail.com> Date: Thu Aug 26 09:37:12 2021 -0300 fix: change image size commit30e9bad0f5Merge:ef99201ccc9468e2Author: Matheus Breguêz <matbrgz@mail.com> Date: Thu Aug 26 09:28:34 2021 -0300 Merge branch 'main' into feat/google-calendar-embed commitef99201c9dAuthor: Matheus Breguêz <matbrgz@mail.com> Date: Fri Jul 9 11:53:56 2021 -0300 Update GoogleCalendar.js commit0e91084756Merge:e98f94c0ec5c47e0Author: Matheus Breguêz <matbrgz@gmail.com> Date: Wed Jul 7 14:49:06 2021 -0300 Merge remote-tracking branch 'origin/feat/google-calendar-embed' into feat/google-calendar-embed commite98f94c02dAuthor: Matheus Breguêz <matbrgz@gmail.com> Date: Wed Jul 7 14:29:49 2021 -0300 feat: Add Google Calendar Embed commitec5c47e0c8Author: Matheus Breguêz <matbrgz@gmail.com> Date: Wed Jul 7 14:29:49 2021 -0300 feat: Add Google Calendar Embed
This commit is contained in:
29
app/embeds/GoogleCalendar.js
Normal file
29
app/embeds/GoogleCalendar.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// @flow
|
||||
import * as React from "react";
|
||||
import Frame from "./components/Frame";
|
||||
|
||||
const URL_REGEX = new RegExp(
|
||||
"^https?://calendar.google.com/calendar/embed\\?src=(.*)$"
|
||||
);
|
||||
|
||||
type Props = {|
|
||||
attrs: {|
|
||||
href: string,
|
||||
matches: string[],
|
||||
|},
|
||||
|};
|
||||
|
||||
export default class GoogleCalendar extends React.Component<Props> {
|
||||
static ENABLED = [URL_REGEX];
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Frame
|
||||
{...this.props}
|
||||
src={this.props.attrs.href}
|
||||
title="Google Calendar"
|
||||
border
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
19
app/embeds/GoogleCalendar.test.js
Normal file
19
app/embeds/GoogleCalendar.test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/* eslint-disable flowtype/require-valid-file-annotation */
|
||||
import GoogleCalendar from "./GoogleCalendar";
|
||||
|
||||
describe("GoogleCalendar", () => {
|
||||
const match = GoogleCalendar.ENABLED[0];
|
||||
test("to be enabled on share link", () => {
|
||||
expect(
|
||||
"https://calendar.google.com/calendar/embed?src=tom%40outline.com&ctz=America%2FSao_Paulo".match(
|
||||
match
|
||||
)
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
test("to not be enabled elsewhere", () => {
|
||||
expect("https://calendar.google.com/calendar".match(match)).toBe(null);
|
||||
expect("https://calendar.google.com".match(match)).toBe(null);
|
||||
expect("https://www.google.com".match(match)).toBe(null);
|
||||
});
|
||||
});
|
||||
@@ -12,6 +12,7 @@ import Diagrams from "./Diagrams";
|
||||
import Figma from "./Figma";
|
||||
import Framer from "./Framer";
|
||||
import Gist from "./Gist";
|
||||
import GoogleCalendar from "./GoogleCalendar";
|
||||
import GoogleDataStudio from "./GoogleDataStudio";
|
||||
import GoogleDocs from "./GoogleDocs";
|
||||
import GoogleDrawings from "./GoogleDrawings";
|
||||
@@ -157,6 +158,13 @@ export default [
|
||||
component: GoogleSlides,
|
||||
matcher: matcher(GoogleSlides),
|
||||
},
|
||||
{
|
||||
title: "Google Calendar",
|
||||
keywords: "calendar",
|
||||
icon: () => <Img src="/images/google-calendar.png" />,
|
||||
component: GoogleCalendar,
|
||||
matcher: matcher(GoogleCalendar),
|
||||
},
|
||||
{
|
||||
title: "Google Data Studio",
|
||||
keywords: "business intelligence",
|
||||
|
||||
BIN
public/images/google-calendar.png
Normal file
BIN
public/images/google-calendar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Reference in New Issue
Block a user