mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-29 10:16:09 +08:00
fix: Fix the issue of missing line breaks in copied log content (#9314)
#9099
This commit is contained in:
parent
8cc7d1f67f
commit
4f6dde02d2
1 changed files with 4 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<span v-for="(token, index) in tokens" :key="index" :class="['token', token.type]" :style="{ color: token.color }">
|
<span v-for="(token, index) in tokens" :key="index" :class="['token', token.type]" :style="{ color: token.color }">
|
||||||
<span v-if="token.type != 'html'">{{ token.text }}</span>
|
<span v-if="token.type != 'html'" class="whitespace-pre">{{ token.text }}</span>
|
||||||
<span v-else v-html="token.text"></span>
|
<span v-else v-html="token.text" class="whitespace-pre"></span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
@ -194,8 +194,9 @@ function tokenizeLog(log: string): Token[] {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (lastIndex < log.length) {
|
if (lastIndex < log.length) {
|
||||||
|
const rest = log.substring(lastIndex).replace(/\n?$/, '\n');
|
||||||
tokens.push({
|
tokens.push({
|
||||||
text: log.substring(lastIndex),
|
text: rest,
|
||||||
type: 'plain',
|
type: 'plain',
|
||||||
color: '#666666',
|
color: '#666666',
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue