From e70568bea9e691759e5db8773c100223efe6e302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ribeiro?= Date: Tue, 18 Jun 2024 17:41:02 -0300 Subject: [PATCH] fix: undo jodit import --- src/components/RichTextEditor/index.tsx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/components/RichTextEditor/index.tsx b/src/components/RichTextEditor/index.tsx index 7d049fa..1a4708b 100644 --- a/src/components/RichTextEditor/index.tsx +++ b/src/components/RichTextEditor/index.tsx @@ -4,19 +4,11 @@ import React, { Suspense, lazy } from "react"; import { Trans, useTranslation } from "react-i18next"; import { useTheme } from "#/components/ThemeToggle/context"; -const JoditEditor = lazy(() => - // @ts-expect-error - import("jodit-react") - .then((obj) => (typeof obj.default === "function" ? obj : obj.default)) - .catch(() => { - // eslint-disable-next-line no-console - console.error( - "You're trying to load jodit-react but it's not installed. Please run `yarn add jodit-react` to install it." - ); - return { default: () =>
Jodit not installed
}; - }) -); - +const JoditEditor = lazy(async () => { + // @ts-ignore + const obj = await import("jodit-react"); + return typeof obj.default === "function" ? obj : obj.default; +}); const EDITOR_BUTTONS = [ "undo", "redo",