Browse Source

fix: 修复选择题详情对话框中内容转义未生效的问题

调整HTML实体解码的时机,确保在处理Markdown渲染前正确解码内容
SanHQin 1 week ago
parent
commit
c969465bf6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/views/Student/components/choiceQuestionDetailDialog.vue

+ 1 - 1
src/views/Student/components/choiceQuestionDetailDialog.vue

@@ -1254,13 +1254,13 @@ const processWorkContent = async (content: string, toolType: number): Promise<an
         parsed.forEach((item: any) => {
           if (item.messages && item.messages.length) {
             item.messages.forEach((item2: any) => {
+               item2.content = item2.content.replace(/&lt;/g, '<').replace(/&quot;/g, '"').replace(/&gt;/g, '>')
               // 如果已经包含html标签则不再渲染
               if (
                 !/^(\s*<[^>]+>.*<\/[^>]+>\s*|<[^>]+\/>\s*)$/s.test(
                   item2.content.trim()
                 )
               ) {
-                item2.content = item2.content.replace(/&lt;/g, '<').replace(/&quot;/g, '"').replace(/&gt;/g, '>')
                 item2.content = md.render(item2.content)
               }
             })