fix: get rid of @html usages (#7072)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-10-31 15:12:16 +07:00 committed by GitHub
parent e96f377dde
commit ef496d55cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 25 additions and 16 deletions

View File

@ -58,5 +58,8 @@
"@typescript-eslint/no-floating-promises": "warn"
}
}
]
],
"rules": {
"svelte/no-at-html-tags": "error"
}
}

View File

@ -13,11 +13,12 @@
// limitations under the License.
-->
<script lang="ts">
import dompurify from 'dompurify'
import DOMPurify from 'dompurify'
export let value: string
$: sanitized = dompurify.sanitize(value)
$: sanitized = DOMPurify.sanitize(value)
</script>
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html sanitized}

View File

@ -30,5 +30,6 @@
{#if text}
<!-- "replaceURLs" produces sanitazed string -->
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html replaceURLs(text)}
{/if}

View File

@ -16,6 +16,7 @@
import { createEventDispatcher } from 'svelte'
import Label from '../Label.svelte'
import IconCheck from '../icons/Check.svelte'
import Html from '../Html.svelte'
export let langs: any
export let selected: string
@ -34,7 +35,7 @@
dispatch('close', lang.id)
}}
>
<div class="svg-16px flex-no-shrink text-16px mr-2">{@html lang.logo}</div>
<div class="svg-16px flex-no-shrink text-16px mr-2"><Html value={lang.logo} /></div>
<span class="overflow-label flex-grow"><Label label={lang.label} /></span>
<div class="ap-check">
{#if lang.id === selected}

View File

@ -17,6 +17,7 @@
import { getMetadata } from '@hcengineering/platform'
import ui, { showPopup, deviceOptionsStore as deviceInfo } from '../..'
import LangPopup from './LangPopup.svelte'
import Html from '../Html.svelte'
let pressed: boolean = false
@ -70,5 +71,7 @@
class:pressed
on:click={selectLanguage}
>
{@html selected?.logo}
{#if selected}
<Html value={selected.logo} />
{/if}
</button>

View File

@ -14,7 +14,7 @@
-->
<script lang="ts">
import { getMetadata, translate } from '@hcengineering/platform'
import { Button, IconClose, Label, themeStore } from '@hcengineering/ui'
import { Button, Html, IconClose, Label, themeStore } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import calendar from '../plugin'
import { concatLink } from '@hcengineering/core'
@ -72,7 +72,7 @@
<Label label={calendar.string.RedirectGoogle} />
</div>
<div class="mt-2">
{@html label}
<Html value={label} />
</div>
<img class="image" src={getMetadata(calendar.image.Permissions)} alt="" />

View File

@ -148,7 +148,7 @@
{/key}
</div>
{#if rejectingMessage !== undefined && approver.approved === 'rejected'}
<div class="reject-message">{@html rejectingMessage}</div>
<div class="reject-message">{rejectingMessage}</div>
{/if}
{/each}
</div>

View File

@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { Loading, themeStore } from '@hcengineering/ui'
import { Html, Loading, themeStore } from '@hcengineering/ui'
import { DiffFile, DiffLine, DiffLineType, DiffViewMode } from '@hcengineering/diffview'
import { DiffLineRenderResult, RenderOptions, renderHunk } from '../highlight'
@ -110,7 +110,7 @@
<td class="num-line {lineClass}">{line.oldNumber ?? ''}</td>
<td class="num-line {lineClass}">{line.newNumber ?? ''}</td>
<td class="code-line select-text {lineClass}" data-code-marker={line.prefix}>
{@html line.content}
<Html value={line.content} />
</td>
</tr>
{/each}
@ -130,11 +130,11 @@
<tr>
<td class="num-line {beforeLineClass}">{before.oldNumber ?? ''}</td>
<td class="code-line select-text {beforeLineClass}" data-code-marker={before.prefix}>
{@html before.content}
<Html value={before.content} />
</td>
<td class="num-line {afterLineClass}">{after.newNumber ?? ''}</td>
<td class="code-line select-text {afterLineClass}" data-code-marker={after.prefix}>
{@html after.content}
<Html value={after.content} />
</td>
</tr>
{/each}

View File

@ -15,7 +15,7 @@
-->
<script lang="ts">
import { getMetadata, translate } from '@hcengineering/platform'
import { Button, IconClose, Label, themeStore } from '@hcengineering/ui'
import { Button, Html, IconClose, Label, themeStore } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import gmail from '../plugin'
import { concatLink } from '@hcengineering/core'
@ -70,7 +70,7 @@
<div class="content">
<Label label={gmail.string.RedirectGoogle} />
<div class="mt-2">
{@html label}
<Html value={label} />
</div>
<div class="footer">

View File

@ -14,7 +14,7 @@
-->
<script lang="ts">
import Play from '../icons/Play.svelte'
import { getPlatformColor, themeStore } from '@hcengineering/ui'
import { Html, getPlatformColor, themeStore } from '@hcengineering/ui'
export let href: string
const maxWidth = 400
@ -75,7 +75,7 @@
</div>
{:else}
<div bind:this={emb}>
{@html data.html}
<Html value={data.html} />
</div>
{/if}
</div>