Functional Component Refactor: Google Docs, Drive, Sheets, & Slides (#4259)
This commit is contained in:
@@ -3,27 +3,27 @@ import Frame from "../components/Frame";
|
||||
import Image from "../components/Image";
|
||||
import { EmbedProps as Props } from ".";
|
||||
|
||||
const URL_REGEX = new RegExp("^https?://drive\\.google\\.com/file/d/(.*)$");
|
||||
|
||||
export default class GoogleDrive extends React.Component<Props> {
|
||||
static ENABLED = [URL_REGEX];
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Frame
|
||||
src={this.props.attrs.href.replace("/view", "/preview")}
|
||||
icon={
|
||||
<Image
|
||||
src="/images/google-drive.png"
|
||||
alt="Google Drive Icon"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
}
|
||||
title="Google Drive"
|
||||
canonicalUrl={this.props.attrs.href}
|
||||
border
|
||||
/>
|
||||
);
|
||||
}
|
||||
function GoogleDrive(props: Props) {
|
||||
return (
|
||||
<Frame
|
||||
src={props.attrs.href.replace("/view", "/preview")}
|
||||
icon={
|
||||
<Image
|
||||
src="/images/google-drive.png"
|
||||
alt="Google Drive Icon"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
}
|
||||
title="Google Drive"
|
||||
canonicalUrl={props.attrs.href}
|
||||
border
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
GoogleDrive.ENABLED = [
|
||||
new RegExp("^https?://drive\\.google\\.com/file/d/(.*)$"),
|
||||
];
|
||||
|
||||
export default GoogleDrive;
|
||||
|
||||
Reference in New Issue
Block a user