Files
outline/shared/editor/embeds/InVision.tsx
Tom Moor acf74b83a8 feat: Full width images (#4389)
* feat: Full width images

* lint

* fix: Enable TOC overlaid on full size images

* Vendorize react-medium-image-zoom

* tsc

* fix

* Remove body scroll lock
2022-12-17 17:17:15 -08:00

33 lines
947 B
TypeScript

import * as React from "react";
import Frame from "../components/Frame";
import ImageZoom from "../components/ImageZoom";
import { EmbedProps as Props } from ".";
const IFRAME_REGEX = /^https:\/\/(invis\.io\/.*)|(projects\.invisionapp\.com\/share\/.*)$/;
const IMAGE_REGEX = /^https:\/\/(opal\.invisionapp\.com\/static-signed\/live-embed\/.*)$/;
function InVision(props: Props) {
if (IMAGE_REGEX.test(props.attrs.href)) {
return (
<div className={props.isSelected ? "ProseMirror-selectednode" : ""}>
<ImageZoom zoomMargin={24}>
<img
src={props.attrs.href}
alt="InVision Embed"
style={{
maxWidth: "100%",
maxHeight: "75vh",
}}
/>
</ImageZoom>
</div>
);
}
return <Frame {...props} src={props.attrs.href} title="InVision Embed" />;
}
InVision.ENABLED = [IFRAME_REGEX, IMAGE_REGEX];
export default InVision;