|
|
@ -8,10 +8,12 @@ import Button from './Button'
|
|
|
|
import Popout, { managePopout } from './Popout'
|
|
|
|
import Popout, { managePopout } from './Popout'
|
|
|
|
import CopySVG from './svg/Copy'
|
|
|
|
import CopySVG from './svg/Copy'
|
|
|
|
|
|
|
|
|
|
|
|
const toIFrame = url =>
|
|
|
|
const toIFrame = (url, width, height) =>
|
|
|
|
`<iframe
|
|
|
|
`<iframe
|
|
|
|
src="${location.origin}/embed${url.replace(/^\/\?/, '?')}"
|
|
|
|
src="${location.origin}/embed${url.replace(/^\/\?/, '?')}"
|
|
|
|
style="transform:scale(0.7); width:1024px; height:473px; border:0; overflow:hidden;"
|
|
|
|
style="width: ${width || 1024}px; height: ${
|
|
|
|
|
|
|
|
height || 473
|
|
|
|
|
|
|
|
}px; border:0; transform: scale(1); overflow:hidden;"
|
|
|
|
sandbox="allow-scripts allow-same-origin">
|
|
|
|
sandbox="allow-scripts allow-same-origin">
|
|
|
|
</iframe>
|
|
|
|
</iframe>
|
|
|
|
`
|
|
|
|
`
|
|
|
@ -52,7 +54,7 @@ function useClipboardSupport() {
|
|
|
|
return isClipboardSupports
|
|
|
|
return isClipboardSupports
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function CopyMenu({ isVisible, toggleVisibility, copyImage }) {
|
|
|
|
function CopyMenu({ isVisible, toggleVisibility, copyImage, carbonRef }) {
|
|
|
|
const clipboardSupported = useClipboardSupport()
|
|
|
|
const clipboardSupported = useClipboardSupport()
|
|
|
|
|
|
|
|
|
|
|
|
const [showCopied, { loading: copied }] = useAsyncCallback(
|
|
|
|
const [showCopied, { loading: copied }] = useAsyncCallback(
|
|
|
@ -93,7 +95,10 @@ function CopyMenu({ isVisible, toggleVisibility, copyImage }) {
|
|
|
|
</CopyButton>
|
|
|
|
</CopyButton>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
<CopyEmbed title="Medium.com" mapper={toEncodedURL} />
|
|
|
|
<CopyEmbed title="Medium.com" mapper={toEncodedURL} />
|
|
|
|
<CopyEmbed title="IFrame" mapper={toIFrame} />
|
|
|
|
<CopyEmbed
|
|
|
|
|
|
|
|
title="IFrame"
|
|
|
|
|
|
|
|
mapper={url => toIFrame(url, carbonRef.clientWidth, carbonRef.clientHeight)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
<CopyEmbed title="Plain URL" mapper={toURL} />
|
|
|
|
<CopyEmbed title="Plain URL" mapper={toURL} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Popout>
|
|
|
|
</Popout>
|
|
|
|