improve spacing

This commit is contained in:
2023-11-11 16:12:50 +07:00
parent 1c3119577f
commit 5c48ebe103
11 changed files with 666 additions and 744 deletions

View File

@@ -49,8 +49,8 @@ export function useRichContent(content: string, textmode: boolean = false) {
let videos: string[] = [];
let events: string[] = [];
const text = content;
const words = text.split(/(\s+)/);
const text = content.replace(/\n\s*\n/g, '\n');
const words = text.split(/( |\n)/);
if (!textmode) {
images = words.filter((word) => IMAGES.some((el) => word.endsWith(el)));
@@ -151,6 +151,10 @@ export function useRichContent(content: string, textmode: boolean = false) {
);
});
parsedContent = reactStringReplace(parsedContent, '\n', (match, i) => {
return <div key={'n-' + i} className="h-2" />;
});
if (typeof parsedContent[0] === 'string') {
parsedContent[0] = parsedContent[0].trimStart();
}