@crtobiasdelsud/portal-ui 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crtobiasdelsud/portal-ui",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Componentes compartidos entre el portal (Next) y el CMS (Vite) — widgets, views, providers para adapters y article pool.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -7,7 +7,10 @@ export default function V0({ isAmp, inlineStyle, titulo, volanta, copete, ImgEl,
7
7
  : null
8
8
  const TituloEl = <h1 className={isAmp ? 'article-hero__titulo' : `${shared.titulo} ${s.titulo}`}>{titulo}</h1>
9
9
  const CopeteEl = copete
10
- ? <p className={isAmp ? 'article-hero__copete' : `${shared.copete} ${s.copete}`}>{copete}</p>
10
+ ? <p
11
+ className={isAmp ? 'article-hero__copete' : `${shared.copete} ${s.copete}`}
12
+ dangerouslySetInnerHTML={{ __html: copete }}
13
+ />
11
14
  : null
12
15
 
13
16
  return (
@@ -7,7 +7,10 @@ export default function V0Desktop({ isAmp, inlineStyle, titulo, volanta, copete,
7
7
  : null
8
8
  const TituloEl = <h1 className={isAmp ? 'article-hero__titulo' : `${shared.titulo} ${s.titulo}`}>{titulo}</h1>
9
9
  const CopeteEl = copete
10
- ? <p className={isAmp ? 'article-hero__copete' : `${shared.copete} ${s.copete}`}>{copete}</p>
10
+ ? <p
11
+ className={isAmp ? 'article-hero__copete' : `${shared.copete} ${s.copete}`}
12
+ dangerouslySetInnerHTML={{ __html: copete }}
13
+ />
11
14
  : null
12
15
 
13
16
  return (
@@ -7,7 +7,10 @@ export default function V1({ isAmp, inlineStyle, titulo, volanta, copete, ImgEl,
7
7
  : null
8
8
  const TituloEl = <h1 className={isAmp ? 'article-hero__titulo' : `${shared.titulo} ${s.titulo}`}>{titulo}</h1>
9
9
  const CopeteEl = copete
10
- ? <p className={isAmp ? 'article-hero__copete' : `${shared.copete} ${s.copete}`}>{copete}</p>
10
+ ? <p
11
+ className={isAmp ? 'article-hero__copete' : `${shared.copete} ${s.copete}`}
12
+ dangerouslySetInnerHTML={{ __html: copete }}
13
+ />
11
14
  : null
12
15
 
13
16
  return (
@@ -7,7 +7,10 @@ export default function V2({ isAmp, inlineStyle, titulo, volanta, copete, ImgEl,
7
7
  : null
8
8
  const TituloEl = <h1 className={isAmp ? 'article-hero__titulo' : `${shared.titulo} ${s.titulo}`}>{titulo}</h1>
9
9
  const CopeteEl = copete
10
- ? <p className={isAmp ? 'article-hero__copete' : `${shared.copete} ${s.copete}`}>{copete}</p>
10
+ ? <p
11
+ className={isAmp ? 'article-hero__copete' : `${shared.copete} ${s.copete}`}
12
+ dangerouslySetInnerHTML={{ __html: copete }}
13
+ />
11
14
  : null
12
15
 
13
16
  return (
@@ -1,4 +1,5 @@
1
1
  import shared from '../../Bajada.module.scss'
2
+ import { stripHtml } from '../../../../../utils/stripHtml'
2
3
  import s from './V1.module.scss'
3
4
 
4
5
  export default function V1({ isAmp, inlineStyle, volanta, title, copete, authorId, vDesktop }) {
@@ -13,7 +14,7 @@ export default function V1({ isAmp, inlineStyle, volanta, title, copete, authorI
13
14
  <span className={isAmp ? 'bajada__volanta' : shared.volanta}>{volanta}. </span>
14
15
  {title}
15
16
  </h2>
16
- {copete && <p className={isAmp ? 'bajada__copete' : shared.copete}>{copete}</p>}
17
+ {copete && <p className={isAmp ? 'bajada__copete' : shared.copete}>{stripHtml(copete)}</p>}
17
18
  {authorId && <span className={isAmp ? 'bajada__autor' : shared.autor}>Por {authorId}</span>}
18
19
  </div>
19
20
  )
@@ -1,4 +1,5 @@
1
1
  import shared from '../../Bajada.module.scss'
2
+ import { stripHtml } from '../../../../../utils/stripHtml'
2
3
  import s from './V2.module.scss'
3
4
 
4
5
  export default function V2({ isAmp, inlineStyle, volanta, title, copete, authorId, vDesktop }) {
@@ -13,7 +14,7 @@ export default function V2({ isAmp, inlineStyle, volanta, title, copete, authorI
13
14
  <span className={isAmp ? 'bajada__volanta' : shared.volanta}>{volanta}. </span>
14
15
  {title}
15
16
  </h2>
16
- {copete && <p className={isAmp ? 'bajada__copete' : shared.copete}>{copete}</p>}
17
+ {copete && <p className={isAmp ? 'bajada__copete' : shared.copete}>{stripHtml(copete)}</p>}
17
18
  {authorId && <span className={isAmp ? 'bajada__autor' : shared.autor}>Por {authorId}</span>}
18
19
  </div>
19
20
  )
@@ -0,0 +1,13 @@
1
+ export function stripHtml(str) {
2
+ if (!str) return ''
3
+ return String(str)
4
+ .replace(/<[^>]+>/g, '')
5
+ .replace(/&nbsp;/g, ' ')
6
+ .replace(/&amp;/g, '&')
7
+ .replace(/&lt;/g, '<')
8
+ .replace(/&gt;/g, '>')
9
+ .replace(/&quot;/g, '"')
10
+ .replace(/&#39;/g, "'")
11
+ .replace(/\s+/g, ' ')
12
+ .trim()
13
+ }