mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-09 14:59:43 +00:00
FIX des bugs du merge request 884
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
<li>
|
||||
<h2>{{ props.item.title }}</h2>
|
||||
<time class="createdBy" datetime="{{item.startDate.datetime}}">{{
|
||||
$d(newsItemStartDate(), "text")
|
||||
props.item?.startDate
|
||||
? localizeDateTimeFormat(props.item?.startDate, "text")
|
||||
: ""
|
||||
}}</time>
|
||||
<div class="content" v-if="shouldTruncate(item.content)">
|
||||
<div v-html="prepareContent(item.content)"></div>
|
||||
@@ -26,7 +28,9 @@
|
||||
<template #body>
|
||||
<p class="news-date">
|
||||
<time class="createdBy" datetime="{{item.startDate.datetime}}">{{
|
||||
$d(newsItemStartDate(), "text")
|
||||
props.item?.startDate
|
||||
? localizeDateTimeFormat(props.item?.startDate, "text")
|
||||
: ""
|
||||
}}</time>
|
||||
</p>
|
||||
<div v-html="convertMarkdownToHtml(item.content)"></div>
|
||||
@@ -42,7 +46,7 @@ import DOMPurify from "dompurify";
|
||||
import { NewsItemType } from "../../../types";
|
||||
import type { PropType } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { ISOToDatetime } from "../../../chill/js/date";
|
||||
import { localizeDateTimeFormat } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
@@ -133,7 +137,7 @@ const preprocess = (markdown: string): string => {
|
||||
};
|
||||
|
||||
const postprocess = (html: string): string => {
|
||||
DOMPurify.addHook("afterSanitizeAttributes", (node: any) => {
|
||||
DOMPurify.addHook("afterSanitizeAttributes", (node: Element) => {
|
||||
if ("target" in node) {
|
||||
node.setAttribute("target", "_blank");
|
||||
node.setAttribute("rel", "noopener noreferrer");
|
||||
@@ -159,10 +163,6 @@ const prepareContent = (content: string): string => {
|
||||
const htmlContent = convertMarkdownToHtml(content);
|
||||
return truncateContent(htmlContent);
|
||||
};
|
||||
|
||||
const newsItemStartDate = (): null | Date => {
|
||||
return ISOToDatetime(props.item?.startDate.datetime);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
Reference in New Issue
Block a user