Skip to content

Commit 708fa9a

Browse files
authored
Merge pull request #8867 from nextcloud/backport/8856/stable33
[stable33] fix(BulletList): remove `preserveWhitespace: true` parseHTML override
2 parents a43c55d + 98ee4cc commit 708fa9a

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/nodes/BulletList.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ import { listInputRule, toggleListCommand } from '../commands'
1212
* Only there we know the user is not trying to create a task list.
1313
*/
1414
const BulletList = TiptapBulletList.extend({
15-
parseHTML() {
16-
return this.parent?.()?.map((rule) =>
17-
Object.assign(rule, { preserveWhitespace: true }),
18-
)
19-
},
20-
2115
addAttributes() {
2216
return {
2317
...this.parent?.(),

src/tests/markdown.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,26 @@ describe('Markdown though editor', () => {
5252
expect(markdownThroughEditor('- foo\n- bar')).toBe('- foo\n- bar')
5353
expect(markdownThroughEditor('- foo\n\n- bar')).toBe('- foo\n- bar')
5454
expect(markdownThroughEditor('- foo\n\n\n- bar')).toBe('- foo\n- bar')
55+
expect(markdownThroughEditor('- foo\n - bar')).toBe('- foo\n - bar')
56+
expect(markdownThroughEditor('- foo\n - bar\n- baz')).toBe(
57+
'- foo\n - bar\n- baz',
58+
)
59+
expect(markdownThroughEditor('- foo \n bar \n baz')).toBe(
60+
'- foo \n bar \n baz',
61+
)
62+
})
63+
test('ul - no suprious linebreak in nested lists (#8775)', () => {
64+
const source = '- foo\n - bar\n- baz'
65+
const tiptap = createRichEditor()
66+
tiptap.commands.setContent(markdownit.render(source))
67+
// Walk the doc: no hardBreak node should exist in outer list item's paragraph
68+
let hasHardBreak = false
69+
tiptap.state.doc.descendants((node) => {
70+
if (node.type.name === 'hardBreak') {
71+
hasHardBreak = true
72+
}
73+
})
74+
expect(hasHardBreak).toBe(false)
5575
})
5676
test('ol', () => {
5777
expect(markdownThroughEditor('1. foo\n2. bar')).toBe('1. foo\n2. bar')

0 commit comments

Comments
 (0)