fix(editor): 🐛 PDF embed viewer
This commit is contained in:
@ -11,12 +11,9 @@ type Props = {
|
|||||||
|
|
||||||
export const EmbedUploadContent = ({ content, onSubmit }: Props) => {
|
export const EmbedUploadContent = ({ content, onSubmit }: Props) => {
|
||||||
const handleUrlChange = (url: string) => {
|
const handleUrlChange = (url: string) => {
|
||||||
let iframeUrl = sanitizeUrl(
|
const iframeUrl = sanitizeUrl(
|
||||||
url.trim().startsWith('<iframe') ? extractUrlFromIframe(url) : url
|
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 })
|
onSubmit({ ...content, url: iframeUrl })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user