mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-10 12:01:29 -05:00
refac
This commit is contained in:
@@ -3011,7 +3011,7 @@
|
||||
if (e.detail || files.length > 0) {
|
||||
await tick();
|
||||
|
||||
submitHandler(e.detail.replaceAll('\n\n', '\n'));
|
||||
submitHandler(e.detail);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
@@ -3054,7 +3054,7 @@
|
||||
clearDraft();
|
||||
if (e.detail || files.length > 0) {
|
||||
await tick();
|
||||
submitHandler(e.detail.replaceAll('\n\n', '\n'));
|
||||
submitHandler(e.detail);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -36,6 +36,18 @@
|
||||
});
|
||||
turndownService.escape = (string) => string;
|
||||
|
||||
// Produce single newlines between paragraphs instead of double.
|
||||
// TipTap wraps every line in <p> tags; the default Turndown rule emits
|
||||
// \n\n around each paragraph which then required a destructive
|
||||
// replaceAll('\n\n','\n') that also wiped blank lines inside code blocks.
|
||||
// This rule eliminates that hack so <pre><code> content is untouched.
|
||||
turndownService.addRule('singleNewlineParagraphs', {
|
||||
filter: 'p',
|
||||
replacement: function (content) {
|
||||
return '\n' + content + '\n';
|
||||
}
|
||||
});
|
||||
|
||||
// Use turndown-plugin-gfm for proper GFM table support
|
||||
turndownService.use(gfm);
|
||||
|
||||
@@ -435,7 +447,6 @@
|
||||
|
||||
export const setText = (text: string) => {
|
||||
if (!editor || !editor.view) return;
|
||||
text = text.replaceAll('\n\n', '\n');
|
||||
|
||||
if (text === '') {
|
||||
editor.commands.clearContent();
|
||||
|
||||
Reference in New Issue
Block a user