Upgrade javascript libraries (#516)

* Bump react-bootstrap
* Bump library versions and clean up hooks
* Bump intl libraries
* Fix image pasting
This commit is contained in:
InfiniteTF
2020-05-08 04:06:07 +02:00
committed by GitHub
parent 99f88b8d73
commit df2d2c2d09
50 changed files with 3192 additions and 2797 deletions

View File

@@ -25,13 +25,18 @@ const onImageChange = (
if (file) readImage(file, onLoadEnd);
};
const usePasteImage = (onLoadEnd: (this: FileReader) => void) => {
const usePasteImage = (
onLoadEnd: (this: FileReader) => void,
isActive: boolean = true
) => {
useEffect(() => {
const paste = (event: ClipboardEvent) => pasteImage(event, onLoadEnd);
document.addEventListener("paste", paste);
if (isActive) {
document.addEventListener("paste", paste);
}
return () => document.removeEventListener("paste", paste);
});
}, [isActive, onLoadEnd]);
};
const Image = {