mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2024-11-30 17:51:14 +00:00
feat(JSafeHtml): create and use component (#2312)
This commit is contained in:
parent
69f987468b
commit
3149266062
@ -16,11 +16,10 @@
|
||||
</VCardSubtitle>
|
||||
|
||||
<VDivider />
|
||||
<!-- eslint-disable vue/no-v-html vue/no-v-text-v-html-on-component -->
|
||||
<VCardText
|
||||
class="d-flex text-center align-center justify-center"
|
||||
v-html="sanitizeHtml(innerHtml)" />
|
||||
<!-- eslint-enable vue/no-v-html vue/no-v-text-v-html-on-component -->
|
||||
class="d-flex text-center align-center justify-center">
|
||||
<JSafeHtml :html="innerHtml" />
|
||||
</VCardText>
|
||||
<VCardActions class="align-center justify-center">
|
||||
<VBtn
|
||||
variant="elevated"
|
||||
@ -45,7 +44,6 @@
|
||||
import { reactive, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useConfirmDialog as vUseConfirmDialog } from '@vueuse/core';
|
||||
import { sanitizeHtml } from '@/utils/html';
|
||||
|
||||
interface ConfirmDialogState {
|
||||
title: string;
|
||||
|
16
frontend/src/components/lib/JSafeHtml.vue
Normal file
16
frontend/src/components/lib/JSafeHtml.vue
Normal file
@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<span v-html="sanitizeHtml(html, markdown)" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { sanitizeHtml } from '@/utils/html';
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false
|
||||
});
|
||||
|
||||
defineProps<{
|
||||
html: string
|
||||
markdown?: boolean
|
||||
}>();
|
||||
</script>
|
@ -117,13 +117,11 @@
|
||||
<VCol
|
||||
cols="12"
|
||||
md="7">
|
||||
<!-- eslint-disable vue/no-v-html -
|
||||
Output is properly sanitized using sanitizeHtml -->
|
||||
<span
|
||||
v-if="item.Overview"
|
||||
class="item-overview"
|
||||
v-html="sanitizeHtml(item.Overview, true)" />
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
class="item-overview">
|
||||
<JSafeHtml :html="item.Overview" markdown />
|
||||
</span>
|
||||
</VCol>
|
||||
</VCol>
|
||||
</VRow>
|
||||
@ -158,7 +156,6 @@ import { useRoute } from 'vue-router/auto';
|
||||
import { msToTicks } from '@/utils/time';
|
||||
import { defaultSortOrder as sortBy } from '@/utils/items';
|
||||
import { getBlurhash } from '@/utils/images';
|
||||
import { sanitizeHtml } from '@/utils/html';
|
||||
import { useBaseItem } from '@/composables/apis';
|
||||
|
||||
const SINGLE_MAX_LENGTH_MS = 600_000;
|
||||
|
@ -258,13 +258,11 @@
|
||||
class="text-subtitle-1 text-truncate">
|
||||
{{ item.Taglines[0] }}
|
||||
</p>
|
||||
<!-- eslint-disable vue/no-v-html -
|
||||
Output is properly sanitized using sanitizeHtml -->
|
||||
<p
|
||||
v-if="item.Overview"
|
||||
class="item-overview"
|
||||
v-html="sanitizeHtml(item.Overview, true)" />
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
class="item-overview">
|
||||
<JSafeHtml :html="item.Overview" markdown />
|
||||
</p>
|
||||
</div>
|
||||
</VCol>
|
||||
</VRow>
|
||||
@ -309,7 +307,6 @@ import { computed, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router/auto';
|
||||
import { getItemDetailsLink, getMediaStreams } from '@/utils/items';
|
||||
import { getBlurhash } from '@/utils/images';
|
||||
import { sanitizeHtml } from '@/utils/html';
|
||||
import { getItemizedSelect } from '@/utils/forms';
|
||||
import { useBaseItem } from '@/composables/apis';
|
||||
|
||||
|
@ -101,13 +101,11 @@
|
||||
<VCol
|
||||
cols="12"
|
||||
md="7">
|
||||
<!-- eslint-disable vue/no-v-html -
|
||||
Output is properly sanitized using sanitizeHtml -->
|
||||
<span
|
||||
v-if="item.Overview"
|
||||
class="item-overview"
|
||||
v-html="sanitizeHtml(item.Overview, true)" />
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
class="item-overview">
|
||||
<JSafeHtml :html="item.Overview" markdown />
|
||||
</span>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="12"
|
||||
@ -179,7 +177,6 @@ import { computed, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router/auto';
|
||||
import { defaultSortOrder as sortBy } from '@/utils/items';
|
||||
import { getBlurhash } from '@/utils/images';
|
||||
import { sanitizeHtml } from '@/utils/html';
|
||||
import { useDateFns } from '@/composables/use-datefns';
|
||||
import { useBaseItem } from '@/composables/apis';
|
||||
|
||||
|
@ -142,13 +142,11 @@
|
||||
class="text-subtitle-1 text-truncate">
|
||||
{{ item.Taglines[0] }}
|
||||
</p>
|
||||
<!-- eslint-disable vue/no-v-html -
|
||||
Output is properly sanitized using sanitizeHtml -->
|
||||
<p
|
||||
v-if="item.Overview"
|
||||
class="item-overview"
|
||||
v-html="sanitizeHtml(item.Overview, true)" />
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
class="item-overview">
|
||||
<JSafeHtml :html="item.Overview" markdown />
|
||||
</p>
|
||||
</div>
|
||||
</VCol>
|
||||
</VRow>
|
||||
@ -191,7 +189,6 @@ import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router/auto';
|
||||
import { getItemDetailsLink } from '@/utils/items';
|
||||
import { getBlurhash } from '@/utils/images';
|
||||
import { sanitizeHtml } from '@/utils/html';
|
||||
import { useBaseItem } from '@/composables/apis';
|
||||
|
||||
const route = useRoute('/series/[itemId]');
|
||||
|
1
frontend/types/global/components.d.ts
vendored
1
frontend/types/global/components.d.ts
vendored
@ -99,6 +99,7 @@ declare module 'vue' {
|
||||
JHover: typeof import('./../../src/components/lib/JHover.vue')['default']
|
||||
JImg: typeof import('./../../src/components/lib/JImg.vue')['default']
|
||||
JNoop: typeof import('./../../src/components/lib/JNoop.vue')['default']
|
||||
JSafeHtml: typeof import('./../../src/components/lib/JSafeHtml.vue')['default']
|
||||
JTransition: typeof import('./../../src/components/lib/JTransition.vue')['default']
|
||||
LikeButton: typeof import('./../../src/components/Buttons/LikeButton.vue')['default']
|
||||
LoadingIndicator: typeof import('./../../src/components/System/LoadingIndicator.vue')['default']
|
||||
|
Loading…
Reference in New Issue
Block a user