This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
2018-12-15 22:06:29 +00:00
|
|
|
// @flow
|
2020-06-20 20:59:15 +00:00
|
|
|
import * as React from "react";
|
|
|
|
import Frame from "./components/Frame";
|
2018-12-15 22:06:29 +00:00
|
|
|
|
2019-05-08 02:32:03 +00:00
|
|
|
const URL_REGEX = /^https:\/\/(www\.)?(use)?loom.com\/(embed|share)\/(.*)$/;
|
2018-12-15 22:06:29 +00:00
|
|
|
|
2020-05-20 03:39:34 +00:00
|
|
|
type Props = {|
|
|
|
|
attrs: {|
|
|
|
|
href: string,
|
|
|
|
matches: string[],
|
|
|
|
|},
|
|
|
|
|};
|
2018-12-15 22:06:29 +00:00
|
|
|
|
|
|
|
export default class Loom extends React.Component<Props> {
|
|
|
|
static ENABLED = [URL_REGEX];
|
|
|
|
|
|
|
|
render() {
|
2020-06-20 20:59:15 +00:00
|
|
|
const normalizedUrl = this.props.attrs.href.replace("share", "embed");
|
2018-12-15 22:06:29 +00:00
|
|
|
|
2020-09-21 05:27:11 +00:00
|
|
|
return <Frame {...this.props} src={normalizedUrl} title="Loom Embed" />;
|
2018-12-15 22:06:29 +00:00
|
|
|
}
|
|
|
|
}
|