feat(editor): support google form embeds (#3930)

Fixes #3129 and #3923
This commit is contained in:
Apoorv Mishra
2022-08-07 12:41:30 +05:30
committed by GitHub
parent 74d9409cc3
commit 982ab2b48e
4 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import * as React from "react";
import Frame from "../components/Frame";
import Image from "../components/Image";
import { EmbedProps as Props } from ".";
function GoogleForms(props: Props) {
return (
<Frame
{...props}
src={props.attrs.href.replace(
/\/(edit|viewform)(\?.+)?$/,
"/viewform?embedded=true"
)}
icon={
<Image
src="/images/google-forms.png"
alt="Google Forms Icon"
width={16}
height={16}
/>
}
canonicalUrl={props.attrs.href}
title="Google Forms"
border
/>
);
}
GoogleForms.ENABLED = [
new RegExp("^https?://docs\\.google\\.com/forms/d/(.+)$"),
];
export default GoogleForms;