feat: Allow Google Embeds from regular (non publish-to-web) links (#1533)

Improve styling to allow getting back to source document
This commit is contained in:
Tom Moor
2020-09-15 18:38:42 -07:00
committed by GitHub
parent b3b71d2dc7
commit ac8f0ebaac
8 changed files with 118 additions and 31 deletions

View File

@@ -2,9 +2,7 @@
import * as React from "react";
import Frame from "./components/Frame";
const URL_REGEX = new RegExp(
"^https?://docs.google.com/document/d/(.*)/pub(.*)$"
);
const URL_REGEX = new RegExp("^https?://docs.google.com/document/(.*)$");
type Props = {|
attrs: {|
@@ -18,7 +16,20 @@ export default class GoogleDocs extends React.Component<Props> {
render() {
return (
<Frame src={this.props.attrs.href} title="Google Docs Embed" border />
<Frame
src={this.props.attrs.href.replace("/edit", "/preview")}
icon={
<img
src="/images/google-docs.png"
alt="Google Docs Icon"
width={16}
height={16}
/>
}
canonicalUrl={this.props.attrs.href}
title="Google Docs"
border
/>
);
}
}