@@ -17,13 +17,7 @@ export const GeneralPreviewComponent: FC<{
1717 const mediaDir = useMediaDirectory ( ) ;
1818
1919 const renderContent = topValue . map ( ( p ) => {
20- const newContent = stripHtmlValidation ( 'html' , p . content , true )
21- . replace ( / ( @ .+ ?) ( \s ) / gi, ( match , match1 , match2 ) => {
22- return `<span class="font-bold" style="color: #ae8afc">${ match1 . trim ( ) } ${ match2 } </span>` ;
23- } )
24- . replace ( / @ \[ ( .+ ?) ] \( ( .+ ?) \) / gi, ( match , name , id ) => {
25- return `<span class="font-bold" style="color: #ae8afc">@${ name } </span>` ;
26- } ) ;
20+ const newContent = stripHtmlValidation ( 'normal' , p . content , true ) ;
2721
2822 const { start, end } = textSlicer (
2923 integration ?. identifier || '' ,
@@ -32,14 +26,30 @@ export const GeneralPreviewComponent: FC<{
3226 ) ;
3327
3428 const finalValue =
35- newContent . slice ( start , end ) +
29+ newContent
30+ . slice ( start , end )
31+ . replace ( / ( @ .+ ?) ( \s ) / gi, ( match , match1 , match2 ) => {
32+ return `<span class="font-bold" style="color: #ae8afc">${ match1 . trim ( ) } ${ match2 } </span>` ;
33+ } )
34+ . replace ( / @ \[ ( .+ ?) ] \( ( .+ ?) \) / gi, ( match , name , id ) => {
35+ return `<span class="font-bold" style="color: #ae8afc">@${ name } </span>` ;
36+ } ) +
3637 `<mark class="bg-red-500" data-tooltip-id="tooltip" data-tooltip-content="This text will be cropped">` +
37- newContent . slice ( end ) +
38+ newContent
39+ . slice ( end )
40+ . replace ( / ( @ .+ ?) ( \s ) / gi, ( match , match1 , match2 ) => {
41+ return `<span class="font-bold" style="color: #ae8afc">${ match1 . trim ( ) } ${ match2 } </span>` ;
42+ } )
43+ . replace ( / @ \[ ( .+ ?) ] \( ( .+ ?) \) / gi, ( match , name , id ) => {
44+ return `<span class="font-bold" style="color: #ae8afc">@${ name } </span>` ;
45+ } ) +
3846 `</mark>` ;
3947
4048 return { text : finalValue , images : p . image } ;
4149 } ) ;
4250
51+ console . log ( renderContent ) ;
52+
4353 return (
4454 < div className = { clsx ( 'w-full md:w-[555px] px-[16px]' ) } >
4555 < div className = "w-full h-full relative flex flex-col" >
@@ -103,7 +113,11 @@ export const GeneralPreviewComponent: FC<{
103113 </ div >
104114 </ div >
105115 < div
106- className = { clsx ( 'text-wrap whitespace-pre' , 'preview' , interClass ) }
116+ className = { clsx (
117+ 'text-wrap whitespace-pre' ,
118+ 'preview' ,
119+ interClass
120+ ) }
107121 dangerouslySetInnerHTML = { {
108122 __html : value . text ,
109123 } }
0 commit comments