diff --git a/app/components/DocumentPreview/DocumentPreview.js b/app/components/DocumentPreview/DocumentPreview.js index 4c91e0094..6f41db5fd 100644 --- a/app/components/DocumentPreview/DocumentPreview.js +++ b/app/components/DocumentPreview/DocumentPreview.js @@ -9,6 +9,7 @@ import Document from "models/Document"; import Badge from "components/Badge"; import Button from "components/Button"; import DocumentMeta from "components/DocumentMeta"; +import EventBoundary from "components/EventBoundary"; import Flex from "components/Flex"; import Highlight from "components/Highlight"; import Tooltip from "components/Tooltip"; @@ -123,7 +124,9 @@ class DocumentPreview extends React.Component { )}   - + + + diff --git a/app/components/EventBoundary.js b/app/components/EventBoundary.js new file mode 100644 index 000000000..16b64809b --- /dev/null +++ b/app/components/EventBoundary.js @@ -0,0 +1,16 @@ +// @flow + +import * as React from "react"; + +type Props = { + children: React.Node, +}; + +export default function EventBoundary({ children }: Props) { + const handleClick = React.useCallback((event: SyntheticEvent<>) => { + event.preventDefault(); + event.stopPropagation(); + }, []); + + return {children}; +}