fix(styles): allow whitespace rendering in rich text fields and retain inline styles
This commit is contained in:
parent
9812d70c71
commit
242ea2f60f
@ -108,13 +108,13 @@ export default async function NoticiaDetail({ params }: { params: Promise<{ slug
|
||||
)}
|
||||
|
||||
<div
|
||||
className="prose prose-invert prose-cyan max-w-none text-slate-300 leading-relaxed text-lg
|
||||
className="prose prose-invert prose-cyan max-w-none text-slate-300 leading-relaxed text-lg whitespace-pre-wrap break-words
|
||||
prose-headings:font-outfit prose-headings:font-black prose-headings:text-white
|
||||
prose-p:mb-6 prose-strong:text-cyan-400"
|
||||
prose-p:mb-6 prose-strong:text-cyan-400 prose-p:empty:before:content-['\\00a0']"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: DOMPurify.sanitize(post.contenido, {
|
||||
ADD_TAGS: ['iframe'],
|
||||
ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling']
|
||||
ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling', 'style', 'class']
|
||||
})
|
||||
}}
|
||||
/>
|
||||
|
||||
@ -11,7 +11,7 @@ import DOMPurify from 'isomorphic-dompurify';
|
||||
const safeHtmlSchema = z.string().transform(html =>
|
||||
DOMPurify.sanitize(html, {
|
||||
ADD_TAGS: ['iframe'],
|
||||
ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling']
|
||||
ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling', 'style', 'class']
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@ -250,7 +250,7 @@ export const RichTextEditor = ({ value, onChange, label }: RichTextEditorProps)
|
||||
},
|
||||
editorProps: {
|
||||
attributes: {
|
||||
class: 'prose prose-invert max-w-none focus:outline-none min-h-[300px] p-6 text-slate-200 leading-relaxed custom-scrollbar',
|
||||
class: 'prose prose-invert max-w-none focus:outline-none min-h-[300px] p-6 text-slate-200 leading-relaxed custom-scrollbar whitespace-pre-wrap break-words prose-p:empty:before:content-["\\00a0"]',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user