Refactor editor architecture

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2023-08-01 08:58:35 +03:00
parent 880c20661e
commit f1f969c8ea
10 changed files with 265 additions and 224 deletions

View File

@@ -64,10 +64,7 @@ const guessMimeType = async (
uri: string,
hint?: string | null,
): Promise<string | undefined> => {
if (hint) {
if (allowedMimeTypes.includes(hint)) return hint;
if (!hint.startsWith('image/')) return undefined;
}
if (hint && allowedMimeTypes.includes(hint)) return hint;
const guessedMimeType = guessMimeTypeFromExtension(uri);
if (guessedMimeType) return guessedMimeType;