mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac/fix: insert prompt as rich text
This commit is contained in:
parent
9942de8011
commit
eb9c4c0e35
1 changed files with 10 additions and 6 deletions
|
|
@ -1,5 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { marked } from 'marked';
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
marked.use({
|
||||
breaks: true,
|
||||
gfm: true,
|
||||
|
|
@ -336,12 +338,14 @@
|
|||
let tr = state.tr;
|
||||
|
||||
if (insertPromptAsRichText) {
|
||||
const htmlContent = marked
|
||||
.parse(text, {
|
||||
breaks: true,
|
||||
gfm: true
|
||||
})
|
||||
.trim();
|
||||
const htmlContent = DOMPurify.sanitize(
|
||||
marked
|
||||
.parse(text, {
|
||||
breaks: true,
|
||||
gfm: true
|
||||
})
|
||||
.trim()
|
||||
);
|
||||
|
||||
// Create a temporary div to parse HTML
|
||||
const tempDiv = document.createElement('div');
|
||||
|
|
|
|||
Loading…
Reference in a new issue