diff --git a/src/nodes/BulletList.ts b/src/nodes/BulletList.ts index 11118abb9d5..1ab7b07f4ce 100644 --- a/src/nodes/BulletList.ts +++ b/src/nodes/BulletList.ts @@ -12,12 +12,6 @@ import { listInputRule, toggleListCommand } from '../commands' * Only there we know the user is not trying to create a task list. */ const BulletList = TiptapBulletList.extend({ - parseHTML() { - return this.parent?.()?.map((rule) => - Object.assign(rule, { preserveWhitespace: true }), - ) - }, - addAttributes() { return { ...this.parent?.(), diff --git a/src/tests/markdown.spec.js b/src/tests/markdown.spec.js index 70ef5f72b78..30ffeb9bddc 100644 --- a/src/tests/markdown.spec.js +++ b/src/tests/markdown.spec.js @@ -52,6 +52,26 @@ describe('Markdown though editor', () => { expect(markdownThroughEditor('- foo\n- bar')).toBe('- foo\n- bar') expect(markdownThroughEditor('- foo\n\n- bar')).toBe('- foo\n- bar') expect(markdownThroughEditor('- foo\n\n\n- bar')).toBe('- foo\n- bar') + expect(markdownThroughEditor('- foo\n - bar')).toBe('- foo\n - bar') + expect(markdownThroughEditor('- foo\n - bar\n- baz')).toBe( + '- foo\n - bar\n- baz', + ) + expect(markdownThroughEditor('- foo \n bar \n baz')).toBe( + '- foo \n bar \n baz', + ) + }) + test('ul - no suprious linebreak in nested lists (#8775)', () => { + const source = '- foo\n - bar\n- baz' + const tiptap = createRichEditor() + tiptap.commands.setContent(markdownit.render(source)) + // Walk the doc: no hardBreak node should exist in outer list item's paragraph + let hasHardBreak = false + tiptap.state.doc.descendants((node) => { + if (node.type.name === 'hardBreak') { + hasHardBreak = true + } + }) + expect(hasHardBreak).toBe(false) }) test('ol', () => { expect(markdownThroughEditor('1. foo\n2. bar')).toBe('1. foo\n2. bar')