diff --git a/shared/editor/embeds/InVision.tsx b/shared/editor/embeds/InVision.tsx index f12a7e08a..bac9f87da 100644 --- a/shared/editor/embeds/InVision.tsx +++ b/shared/editor/embeds/InVision.tsx @@ -6,34 +6,28 @@ import { EmbedProps as Props } from "."; const IFRAME_REGEX = /^https:\/\/(invis\.io\/.*)|(projects\.invisionapp\.com\/share\/.*)$/; const IMAGE_REGEX = /^https:\/\/(opal\.invisionapp\.com\/static-signed\/live-embed\/.*)$/; -export default class InVision extends React.Component { - static ENABLED = [IFRAME_REGEX, IMAGE_REGEX]; - - render() { - if (IMAGE_REGEX.test(this.props.attrs.href)) { - return ( - - ); - } - +function InVision(props: Props) { + if (IMAGE_REGEX.test(props.attrs.href)) { return ( - ); } + + return ; } + +InVision.ENABLED = [IFRAME_REGEX, IMAGE_REGEX]; + +export default InVision; diff --git a/shared/editor/embeds/Loom.tsx b/shared/editor/embeds/Loom.tsx index 0222a7b06..99421b292 100644 --- a/shared/editor/embeds/Loom.tsx +++ b/shared/editor/embeds/Loom.tsx @@ -2,13 +2,11 @@ import * as React from "react"; import Frame from "../components/Frame"; import { EmbedProps as Props } from "."; -const URL_REGEX = /^https:\/\/(www\.)?(use)?loom\.com\/(embed|share)\/(.*)$/; - -export default class Loom extends React.Component { - static ENABLED = [URL_REGEX]; - - render() { - const normalizedUrl = this.props.attrs.href.replace("share", "embed"); - return ; - } +function Loom(props: Props) { + const normalizedUrl = props.attrs.href.replace("share", "embed"); + return ; } + +Loom.ENABLED = [/^https:\/\/(www\.)?(use)?loom\.com\/(embed|share)\/(.*)$/]; + +export default Loom; diff --git a/shared/editor/embeds/Lucidchart.tsx b/shared/editor/embeds/Lucidchart.tsx index f2981eeae..9cec8a50d 100644 --- a/shared/editor/embeds/Lucidchart.tsx +++ b/shared/editor/embeds/Lucidchart.tsx @@ -2,22 +2,22 @@ import * as React from "react"; import Frame from "../components/Frame"; import { EmbedProps as Props } from "."; -export default class Lucidchart extends React.Component { - static ENABLED = [ - /^https?:\/\/(www\.|app\.)?(lucidchart\.com|lucid\.app)\/documents\/(embeddedchart|view|edit)\/(?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})(?:.*)?$/, - /^https?:\/\/(www\.|app\.)?(lucid\.app|lucidchart\.com)\/lucidchart\/(?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\/(embeddedchart|view|edit)(?:.*)?$/, - ]; +function Lucidchart(props: Props) { + const { matches } = props.attrs; + const chartId = matches.groups?.chartId; - render() { - const { matches } = this.props.attrs; - const chartId = matches.groups?.chartId; - - return ( - - ); - } + return ( + + ); } + +Lucidchart.ENABLED = [ + /^https?:\/\/(www\.|app\.)?(lucidchart\.com|lucid\.app)\/documents\/(embeddedchart|view|edit)\/(?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})(?:.*)?$/, + /^https?:\/\/(www\.|app\.)?(lucid\.app|lucidchart\.com)\/lucidchart\/(?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\/(embeddedchart|view|edit)(?:.*)?$/, +]; + +export default Lucidchart;