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" "@typescript-eslint/no-floating-promises": "warn"
} }
} }
] ],
"rules": {
"svelte/no-at-html-tags": "error"
}
} }

View File

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

View File

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

View File

@ -16,6 +16,7 @@
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import Label from '../Label.svelte' import Label from '../Label.svelte'
import IconCheck from '../icons/Check.svelte' import IconCheck from '../icons/Check.svelte'
import Html from '../Html.svelte'
export let langs: any export let langs: any
export let selected: string export let selected: string
@ -34,7 +35,7 @@
dispatch('close', lang.id) 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> <span class="overflow-label flex-grow"><Label label={lang.label} /></span>
<div class="ap-check"> <div class="ap-check">
{#if lang.id === selected} {#if lang.id === selected}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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