Skip to content

Commit

Permalink
fix: undo jodit import
Browse files Browse the repository at this point in the history
  • Loading branch information
ribeirojose committed Jun 18, 2024
1 parent 585a9a2 commit e70568b
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/components/RichTextEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => <div>Jodit not installed</div> };
})
);

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",
Expand Down

0 comments on commit e70568b

Please sign in to comment.