diff --git a/src/lib/components/Editor.svelte b/src/lib/components/Editor.svelte
index 2c4881f..43ea8cb 100644
--- a/src/lib/components/Editor.svelte
+++ b/src/lib/components/Editor.svelte
@@ -3010,6 +3010,9 @@
}
entries.push({ text: serializeNode(node), isImage: isImageNode(node) });
});
+ while (entries.length > 0 && entries[entries.length - 1].text === '') {
+ entries.pop();
+ }
// Join: skip extra \n separator before image nodes so they don't get unwanted blank lines
let result = '';
for (let i = 0; i < entries.length; i++) {
@@ -3819,10 +3822,10 @@
src = src.replace(/^([\s>]*)-\s\[ \][^\S\n]+(.+)$/gm, '$1-
]*)>\n?/g, '');
html = html.replace(/\n<\/code>/g, '');
- // Post-process: convert list-separator comments back to empty paragraphs for TipTap
- html = html.replace(//g, '');
+ // Post-process: convert empty-paragraph div sentinels back to empty paragraphs for TipTap
+ html = html.replace(/<\/div>\n?/g, '\n');
// Post-process: convert task list items to TipTap format
// Convert opening + into data-attributed , handles both tight and loose (with ) lists