mirror of
https://github.com/open-webui/open-webui
synced 2024-12-29 07:12:07 +00:00
refac: rich text input
This commit is contained in:
parent
5b879a2121
commit
fda26b4ad0
@ -2,7 +2,8 @@
|
|||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
import TurndownService from 'turndown';
|
import TurndownService from 'turndown';
|
||||||
const turndownService = new TurndownService({
|
const turndownService = new TurndownService({
|
||||||
codeBlockStyle: 'fenced'
|
codeBlockStyle: 'fenced',
|
||||||
|
headingStyle: 'atx'
|
||||||
});
|
});
|
||||||
turndownService.escape = (string) => string;
|
turndownService.escape = (string) => string;
|
||||||
|
|
||||||
@ -124,6 +125,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
console.log(value);
|
||||||
async function tryParse(value, attempts = 3, interval = 100) {
|
async function tryParse(value, attempts = 3, interval = 100) {
|
||||||
try {
|
try {
|
||||||
// Try parsing the value
|
// Try parsing the value
|
||||||
@ -181,10 +183,13 @@
|
|||||||
if (value !== newValue) {
|
if (value !== newValue) {
|
||||||
value = newValue;
|
value = newValue;
|
||||||
|
|
||||||
|
// check if the node is paragraph as well
|
||||||
|
if (editor.isActive('paragraph')) {
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
editor.commands.clearContent();
|
editor.commands.clearContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
editorProps: {
|
editorProps: {
|
||||||
attributes: { id },
|
attributes: { id },
|
||||||
|
Loading…
Reference in New Issue
Block a user