1
0
Эх сурвалжийг харах

fix: non rich text handling

Timothy Jaeryang Baek 1 долоо хоног өмнө
parent
commit
b1c196ed83

+ 13 - 5
src/lib/components/common/RichTextInput.svelte

@@ -789,11 +789,19 @@
 					)
 					.replace(/\u00a0/g, ' ');
 
-				onChange({
-					html: htmlValue,
-					json: jsonValue,
-					md: mdValue
-				});
+				if (richText) {
+					onChange({
+						html: htmlValue,
+						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) {
 					value = jsonValue;