2
0

fix(editor): 🐛 PDF embed viewer

This commit is contained in:
Baptiste Arnaud
2022-03-24 10:12:49 +01:00
parent b8019f3732
commit bcff2e0c14

View File

@ -11,12 +11,9 @@ type Props = {
export const EmbedUploadContent = ({ content, onSubmit }: Props) => {
const handleUrlChange = (url: string) => {
let iframeUrl = sanitizeUrl(
const iframeUrl = sanitizeUrl(
url.trim().startsWith('<iframe') ? extractUrlFromIframe(url) : url
)
if (iframeUrl.endsWith('.pdf')) {
iframeUrl = `https://docs.google.com/viewer?embedded=true&url=${iframeUrl}`
}
onSubmit({ ...content, url: iframeUrl })
}