refac
This commit is contained in:
@@ -3011,7 +3011,7 @@
|
|||||||
if (e.detail || files.length > 0) {
|
if (e.detail || files.length > 0) {
|
||||||
await tick();
|
await tick();
|
||||||
|
|
||||||
submitHandler(e.detail.replaceAll('\n\n', '\n'));
|
submitHandler(e.detail);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -3054,7 +3054,7 @@
|
|||||||
clearDraft();
|
clearDraft();
|
||||||
if (e.detail || files.length > 0) {
|
if (e.detail || files.length > 0) {
|
||||||
await tick();
|
await tick();
|
||||||
submitHandler(e.detail.replaceAll('\n\n', '\n'));
|
submitHandler(e.detail);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -36,6 +36,18 @@
|
|||||||
});
|
});
|
||||||
turndownService.escape = (string) => string;
|
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
|
// Use turndown-plugin-gfm for proper GFM table support
|
||||||
turndownService.use(gfm);
|
turndownService.use(gfm);
|
||||||
|
|
||||||
@@ -435,7 +447,6 @@
|
|||||||
|
|
||||||
export const setText = (text: string) => {
|
export const setText = (text: string) => {
|
||||||
if (!editor || !editor.view) return;
|
if (!editor || !editor.view) return;
|
||||||
text = text.replaceAll('\n\n', '\n');
|
|
||||||
|
|
||||||
if (text === '') {
|
if (text === '') {
|
||||||
editor.commands.clearContent();
|
editor.commands.clearContent();
|
||||||
|
|||||||
Reference in New Issue
Block a user