This commit is contained in:
Timothy Jaeryang Baek
2026-04-17 14:57:49 +09:00
parent f0e0cfcf02
commit 1be9627dd2
2 changed files with 14 additions and 3 deletions

View File

@@ -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);
}
}}
/>

View File

@@ -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();