Fixed no shortcode

This commit is contained in:
cdricms
2025-02-11 10:12:37 +01:00
parent 60dd966f3e
commit 2c2be9fdba
6 changed files with 644 additions and 104 deletions

View File

@@ -3,9 +3,9 @@
import { Textarea } from "@/components/ui/textarea";
import { useEffect, useRef, useState } from "react";
import { marked } from "marked";
import DOMPurify from "dompurify";
import DOMPurify from "isomorphic-dompurify";
import { Button } from "@/components/ui/button";
import { Bold, Italic, Link, Strikethrough, Underline } from "lucide-react";
import { Bold, Italic, Strikethrough, Underline } from "lucide-react";
enum Command {
Italic = "*",
@@ -79,6 +79,8 @@ export default function NewBlog() {
moveCursor(cursor.column + 2);
};
const sanitized = DOMPurify.sanitize(marked(text, { async: false }));
return (
<section className="flex">
<div>
@@ -133,7 +135,8 @@ export default function NewBlog() {
<div
className="mt-4 p-2 bg-gray-100 border rounded-md text-sm text-black"
dangerouslySetInnerHTML={{
__html: DOMPurify.sanitize(marked(text, { async: false })),
// @ts-ignore
__html: sanitized,
}}
></div>
</section>