noteJS-react/src/components/notes/NotePreview.tsx

26 lines
759 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from "react";
import { parseMarkdown } from "../../utils/markdown";
import { useMarkdown } from "../../hooks/useMarkdown";
interface NotePreviewProps {
content: string;
}
export const NotePreview: React.FC<NotePreviewProps> = ({ content }) => {
useMarkdown(); // Инициализируем обработчики спойлеров и внешних ссылок
const htmlContent = parseMarkdown(content);
return (
<div className="note-preview-container" style={{ display: "block" }}>
<div className="note-preview-header">
<span>Предпросмотр:</span>
</div>
<div
className="note-preview-content"
dangerouslySetInnerHTML={{ __html: htmlContent }}
/>
</div>
);
};