File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 30113011 if (e .detail || files .length > 0 ) {
30123012 await tick ();
30133013
3014- submitHandler (e .detail . replaceAll ( ' \n\n ' , ' \n ' ) );
3014+ submitHandler (e .detail );
30153015 }
30163016 }}
30173017 />
30543054 clearDraft ();
30553055 if (e .detail || files .length > 0 ) {
30563056 await tick ();
3057- submitHandler (e .detail . replaceAll ( ' \n\n ' , ' \n ' ) );
3057+ submitHandler (e .detail );
30583058 }
30593059 }}
30603060 />
Original file line number Diff line number Diff line change 3636 });
3737 turndownService .escape = (string ) => string ;
3838
39+ // Produce single newlines between paragraphs instead of double.
40+ // TipTap wraps every line in <p> tags; the default Turndown rule emits
41+ // \n\n around each paragraph which then required a destructive
42+ // replaceAll('\n\n','\n') that also wiped blank lines inside code blocks.
43+ // This rule eliminates that hack so <pre><code> content is untouched.
44+ turndownService .addRule (' singleNewlineParagraphs' , {
45+ filter: ' p' ,
46+ replacement : function (content ) {
47+ return ' \n ' + content + ' \n ' ;
48+ }
49+ });
50+
3951 // Use turndown-plugin-gfm for proper GFM table support
4052 turndownService .use (gfm );
4153
435447
436448 export const setText = (text : string ) => {
437449 if (! editor || ! editor .view ) return ;
438- text = text .replaceAll (' \n\n ' , ' \n ' );
439450
440451 if (text === ' ' ) {
441452 editor .commands .clearContent ();
You can’t perform that action at this time.
0 commit comments