@@ -3,18 +3,13 @@ import { getNames } from '@vitest/ws-client'
33import { client , currentLogs as logs } from ' ~/composables/client'
44import { isDark } from ' ~/composables/dark'
55import { createAnsiToHtmlFilter } from ' ~/composables/error'
6+ import { escapeHtml } from " ~/utils/escape"
67
78const formattedLogs = computed (() => {
89 const data = logs .value
910 if (data ) {
1011 const filter = createAnsiToHtmlFilter (isDark .value )
11- return data .map (({ taskId , type , time , content }) => {
12- const trimmed = content .trim ()
13- const value = filter .toHtml (trimmed )
14- return value !== trimmed
15- ? { taskId , type , time , html: true , content: value }
16- : { taskId , type , time , html: false , content }
17- })
12+ return data .map (({ taskId , type , time , content }) => ({ taskId , type , time , content: filter .toHtml (escapeHtml (content )) }))
1813 }
1914})
2015
@@ -26,13 +21,12 @@ function getTaskName(id?: string) {
2621
2722<template >
2823 <div v-if =" formattedLogs?.length" h-full class =" scrolls" flex flex-col data-testid =" logs" >
29- <div v-for =" { taskId, type, time, html, content } of formattedLogs" :key =" taskId" font-mono >
24+ <div v-for =" { taskId, type, time, content } of formattedLogs" :key =" taskId" font-mono >
3025 <ViewConsoleOutputEntry
3126 :task-name =" getTaskName(taskId)"
3227 :type =" type"
3328 :time =" time"
3429 :content =" content"
35- :html =" html"
3630 />
3731 </div >
3832 </div >
0 commit comments