remove sanitize-html
This commit is contained in:
parent
5d958de5a8
commit
b053aded18
1719
package-lock.json
generated
1719
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -35,8 +35,6 @@
|
||||||
"i18next-icu": "2.3.0",
|
"i18next-icu": "2.3.0",
|
||||||
"intl-messageformat": "10.5.3",
|
"intl-messageformat": "10.5.3",
|
||||||
"just-throttle": "4.2.0",
|
"just-throttle": "4.2.0",
|
||||||
"mailgun.js": "8.2.1",
|
|
||||||
"sanitize-html": "2.11.0",
|
|
||||||
"mailgun.js": "8.2.1"
|
"mailgun.js": "8.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { createMemo, createSignal, For, Show } from 'solid-js'
|
import { createMemo, createSignal, For, Show } from 'solid-js'
|
||||||
import sanitizeHtml from 'sanitize-html'
|
|
||||||
|
|
||||||
import type { Shout } from '../../../graphql/types.gen'
|
import type { Shout } from '../../../graphql/types.gen'
|
||||||
|
|
||||||
|
@ -90,14 +89,6 @@ const getTitleAndSubtitle = (
|
||||||
return { title, subtitle }
|
return { title, subtitle }
|
||||||
}
|
}
|
||||||
|
|
||||||
const sanitizeString = (html) =>
|
|
||||||
sanitizeHtml(html, {
|
|
||||||
allowedTags: ['span'],
|
|
||||||
allowedAttributes: {
|
|
||||||
span: ['class'],
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export const ArticleCard = (props: ArticleCardProps) => {
|
export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
const { t, lang, formatDate } = useLocalize()
|
const { t, lang, formatDate } = useLocalize()
|
||||||
const { user } = useSession()
|
const { user } = useSession()
|
||||||
|
@ -223,13 +214,13 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
<a href={getPagePath(router, 'article', { slug: props.article.slug })}>
|
<a href={getPagePath(router, 'article', { slug: props.article.slug })}>
|
||||||
<div class={styles.shoutCardTitle}>
|
<div class={styles.shoutCardTitle}>
|
||||||
<span class={styles.shoutCardLinkWrapper}>
|
<span class={styles.shoutCardLinkWrapper}>
|
||||||
<span class={styles.shoutCardLinkContainer} innerHTML={sanitizeString(title)} />
|
<span class={styles.shoutCardLinkContainer} innerHTML={title} />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Show when={!props.settings?.nosubtitle && subtitle}>
|
<Show when={!props.settings?.nosubtitle && subtitle}>
|
||||||
<div class={styles.shoutCardSubtitle}>
|
<div class={styles.shoutCardSubtitle}>
|
||||||
<span class={styles.shoutCardLinkContainer} innerHTML={sanitizeString(subtitle)} />
|
<span class={styles.shoutCardLinkContainer} innerHTML={subtitle} />
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</a>
|
</a>
|
||||||
|
@ -259,10 +250,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
<Show when={props.article.description}>
|
<Show when={props.article.description}>
|
||||||
<section
|
<section class={styles.shoutCardDescription} innerHTML={props.article.description} />
|
||||||
class={styles.shoutCardDescription}
|
|
||||||
innerHTML={sanitizeString(props.article.description)}
|
|
||||||
/>
|
|
||||||
</Show>
|
</Show>
|
||||||
<Show when={props.settings?.isFeedMode}>
|
<Show when={props.settings?.isFeedMode}>
|
||||||
<Show when={props.article.description}>
|
<Show when={props.article.description}>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createSignal, Show, For, JSX } from 'solid-js'
|
import { createSignal, Show, For } from 'solid-js'
|
||||||
|
|
||||||
import { Button } from '../../_shared/Button'
|
import { Button } from '../../_shared/Button'
|
||||||
import { Icon } from '../../_shared/Icon'
|
import { Icon } from '../../_shared/Icon'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user