mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-17 14:55:23 +00:00
fix: non rich text handling
This commit is contained in:
parent
a8a0a2655d
commit
b1c196ed83
1 changed files with 13 additions and 5 deletions
|
|
@ -789,11 +789,19 @@
|
||||||
)
|
)
|
||||||
.replace(/\u00a0/g, ' ');
|
.replace(/\u00a0/g, ' ');
|
||||||
|
|
||||||
onChange({
|
if (richText) {
|
||||||
html: htmlValue,
|
onChange({
|
||||||
json: jsonValue,
|
html: htmlValue,
|
||||||
md: mdValue
|
json: jsonValue,
|
||||||
});
|
md: mdValue
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Plain text path: preserve \t and \n exactly
|
||||||
|
const doc = editor.view.state.doc;
|
||||||
|
const plain = doc.textBetween(0, doc.content.size, '\n\n', '\n'); // keeps \t intact
|
||||||
|
value = plain;
|
||||||
|
onChange({ html: null, json: null, md: plain });
|
||||||
|
}
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
value = jsonValue;
|
value = jsonValue;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue