mirror of
https://github.com/outline/outline.git
synced 2025-03-15 19:18:00 +00:00
feat: Berrycast embed support
This commit is contained in:
BIN
public/images/berrycast.png
Normal file
BIN
public/images/berrycast.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 774 B |
27
shared/editor/embeds/Berrycast.tsx
Normal file
27
shared/editor/embeds/Berrycast.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import * as React from "react";
|
||||
import useComponentSize from "~/hooks/useComponentSize";
|
||||
import Frame from "../components/Frame";
|
||||
import { EmbedProps as Props } from ".";
|
||||
|
||||
const URL_REGEX = /^https:\/\/(www\.)?berrycast.com\/conversations\/(.*)$/;
|
||||
|
||||
export default function Berrycast(props: Props) {
|
||||
const normalizedUrl = props.attrs.href.replace(/\/$/, "");
|
||||
const ref = React.useRef<HTMLDivElement>(null);
|
||||
const { width } = useComponentSize(ref);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div ref={ref} />
|
||||
<Frame
|
||||
{...props}
|
||||
src={`${normalizedUrl}/video-player`}
|
||||
title="Berrycast Embed"
|
||||
height={`${0.5625 * width}px`}
|
||||
border={false}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Berrycast.ENABLED = [URL_REGEX];
|
@ -4,6 +4,7 @@ import { EmbedDescriptor } from "@shared/editor/types";
|
||||
import Image from "../components/Image";
|
||||
import Abstract from "./Abstract";
|
||||
import Airtable from "./Airtable";
|
||||
import Berrycast from "./Berrycast";
|
||||
import Bilibili from "./Bilibili";
|
||||
import Cawemo from "./Cawemo";
|
||||
import ClickUp from "./ClickUp";
|
||||
@ -86,6 +87,14 @@ const embeds: EmbedDescriptor[] = [
|
||||
component: Airtable,
|
||||
matcher: matcher(Airtable),
|
||||
},
|
||||
{
|
||||
title: "Berrycast",
|
||||
keywords: "video",
|
||||
defaultHidden: true,
|
||||
icon: () => <Img src="/images/berrycast.png" alt="Berrycast" />,
|
||||
component: Berrycast,
|
||||
matcher: matcher(Berrycast),
|
||||
},
|
||||
{
|
||||
title: "Bilibili",
|
||||
keywords: "video",
|
||||
|
Reference in New Issue
Block a user