Add image editor

This commit is contained in:
Josh Perez 2021-11-30 21:14:25 -05:00 committed by GitHub
parent 86d09917a3
commit 7affe313f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 4261 additions and 173 deletions

21
ts/hooks/usePortal.ts Normal file
View file

@ -0,0 +1,21 @@
// Copyright 2019-2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { useEffect, useState } from 'react';
export function usePortal(): HTMLDivElement | null {
const [root, setRoot] = useState<HTMLDivElement | null>(null);
useEffect(() => {
const div = document.createElement('div');
document.body.appendChild(div);
setRoot(div);
return () => {
document.body.removeChild(div);
setRoot(null);
};
}, []);
return root;
}

9
ts/hooks/useUniqueId.ts Normal file
View file

@ -0,0 +1,9 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { useMemo } from 'react';
import { v4 as uuid } from 'uuid';
export function useUniqueId(): string {
return useMemo(() => uuid(), []);
}