diff --git a/src/nodes/BulletList.ts b/src/nodes/BulletList.ts index 1a328dc2289..9d56294de5f 100644 --- a/src/nodes/BulletList.ts +++ b/src/nodes/BulletList.ts @@ -12,10 +12,6 @@ import { listInputRule, toggleListCommand } from '../commands/index.ts' * 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 dd3e7bc7046..2f5bb9e5011 100644 --- a/src/tests/markdown.spec.js +++ b/src/tests/markdown.spec.js @@ -44,6 +44,21 @@ 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)', ({ editor }) => { + const source = '- foo\n - bar\n- baz' + editor.commands.setContent(markdownit.render(source)) + // Walk the doc: no hardBreak node should exist in outer list item's paragraph + let hasHardBreak = false + editor.state.doc.descendants((node) => { + if (node.type.name === 'hardBreak') { + hasHardBreak = true + } + }) + expect(hasHardBreak).toBe(false) }) test('ol', ({ markdownThroughEditor }) => { expect(markdownThroughEditor('1. foo\n2. bar')).toBe('1. foo\n2. bar')