Skip to content

Commit

Permalink
fixed errors on /app/articles/app/page.tsx and added types for isom…
Browse files Browse the repository at this point in the history
…orphic-dompurify (#1179)

* fixed errors on /app/articles/app/page and added types

* Imported <NotFound /> and replace empty string eorr with it.
  • Loading branch information
petercr authored Oct 28, 2024
1 parent 02ac49f commit e760be5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions app/(app)/articles/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import ArticleAdminPanel from "@/components/ArticleAdminPanel/ArticleAdminPanel"
import { type Metadata } from "next";
import { getPost } from "@/server/lib/posts";
import { getCamelCaseFromLower } from "@/utils/utils";
import { generateHTML } from "@tiptap/html";
import { generateHTML } from "@tiptap/core";
import { TiptapExtensions } from "@/components/editor/editor/extensions";
import DOMPurify from "isomorphic-dompurify";
import type { JSONContent } from "@tiptap/core";
import NotFound from "@/components/NotFound/NotFound";

type Props = { params: { slug: string } };

Expand Down Expand Up @@ -119,11 +120,17 @@ const ArticlePage = async ({ params }: Props) => {

{isTiptapContent ? (
<div
dangerouslySetInnerHTML={{ __html: renderedContent }}
dangerouslySetInnerHTML={{
__html: renderedContent ?? <NotFound />,
}}
className="tiptap-content"
/>
) : (
<div>{renderedContent}</div>
<div>
{Markdoc.renderers.react(renderedContent, React, {
components: markdocComponents,
})}
</div>
)}
</article>
{post.tags.length > 0 && (
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"@svgr/webpack": "^8.1.0",
"@tailwindcss/typography": "^0.5.13",
"@types/chance": "^1.1.6",
"@types/dompurify": "^3.0.5",
"@types/node": "^22.7.5",
"@types/nodemailer": "^6.4.15",
"@types/pg": "^8.11.5",
Expand Down

0 comments on commit e760be5

Please sign in to comment.