fix(报告): 测试计划报告总结富文本渲染调整

--bug=1046672 --user=白奇 报告总结中包含表格、任务列表等格式,导出pdf后格式未导出 https://www.tapd.cn/55049933/s/1580970
This commit is contained in:
baiqi 2024-09-19 14:31:17 +08:00 committed by Craftsman
parent e3417dd9d9
commit 4995736e30
2 changed files with 25 additions and 14 deletions
frontend/src
components/pure/ms-rich-text
views/test-plan/report/detail

View File

@ -34,8 +34,6 @@
ExtensionCode,
ExtensionCodeBlock,
ExtensionColor,
ExtensionColumn,
ExtensionColumns,
ExtensionCommands,
ExtensionDocument,
ExtensionDraggable,

View File

@ -108,16 +108,12 @@
:share-id="shareId"
is-preview
/>
<div
v-else-if="item.value === ReportCardTypeEnum.CUSTOM_CARD"
ref="customCardRef"
v-html="item.content"
></div>
<div
v-else-if="item.value === ReportCardTypeEnum.SUMMARY"
ref="summaryRef"
v-html="isDefaultLayout ? detail.summary : item.content"
></div>
<div v-else-if="item.value === ReportCardTypeEnum.CUSTOM_CARD" ref="customCardRef">
<MsRichText :raw="item.content" :editable="false" />
</div>
<div v-else-if="item.value === ReportCardTypeEnum.SUMMARY" ref="summaryRef">
<MsRichText :raw="isDefaultLayout ? detail.summary : item.content" :editable="false" />
</div>
</div>
</div>
</div>
@ -132,6 +128,7 @@
import dayjs from 'dayjs';
import MsChart from '@/components/pure/chart/index.vue';
import MsRichText from '@/components/pure/ms-rich-text/MsRichText.vue';
import type { MsTableColumn } from '@/components/pure/ms-table/type';
import { lastExecuteResultMap } from '@/components/business/ms-case-associate/utils';
import { IconType } from '@/views/api-test/report/component/reportStatus.vue';
@ -784,13 +781,17 @@
//
customCardRef.value.forEach((item) => {
if (item) {
customCardImages = customCardImages.concat(Array.from(item.querySelectorAll('img')));
customCardImages = customCardImages.concat(
Array.from(item.querySelectorAll('img')).filter((e) => e.className !== 'ProseMirror-separator')
);
}
});
}
if (summaryRef.value[0]) {
//
summaryImages = Array.from(summaryRef.value[0].querySelectorAll('img'));
summaryImages = Array.from(summaryRef.value[0].querySelectorAll('img')).filter(
(e) => e.className !== 'ProseMirror-separator'
);
}
if (customCardImages.length > 0 || summaryImages.length > 0) {
let loadedImageCount = 0;
@ -996,4 +997,16 @@
:deep(#ms-table-footer-wrapper) {
@apply hidden;
}
.rich-wrapper {
@apply border-none;
:deep(.halo-rich-text-editor) {
@apply !p-0;
.editor-header {
@apply hidden;
}
.tiptap {
@apply !p-0;
}
}
}
</style>