diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vue index 0322b2c6f9..9fc06e3894 100644 --- a/packages/nc-gui/components/cell/RichText.vue +++ b/packages/nc-gui/components/cell/RichText.vue @@ -19,7 +19,16 @@ const props = defineProps<{ const emits = defineEmits(['update:value']) -const turndownService = new TurndownService() +const turndownService = new TurndownService({}) + +turndownService.addRule('lineBreak', { + filter: (node) => { + return node.nodeName === 'BR' + }, + replacement: () => { + return '
' + }, +}) turndownService.addRule('taskList', { filter: (node) => { @@ -90,7 +99,9 @@ const tiptapExtensions = [ const editor = useEditor({ extensions: tiptapExtensions, onUpdate: ({ editor }) => { - const markdown = turndownService.turndown(editor.getHTML()) + const markdown = turndownService + .turndown(editor.getHTML().replaceAll(/

<\/p>/g, '
')) + .replaceAll(/\n\n
\n\n/g, '
\n\n') vModel.value = markdown },