Fix custom start for ordered lists
This commit is contained in:
committed by
Hans Pagel
parent
97dd95199f
commit
2559ef1af1
@@ -103,6 +103,19 @@ context('/demos/Nodes/OrderedList', () => {
|
||||
.should('contain', 'List Item 2')
|
||||
})
|
||||
|
||||
it('should make a ordered list from a number other than number one', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.type('2. List Item 1{enter}List Item 2')
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.find('ol')
|
||||
.should('have.attr', 'start', '2')
|
||||
})
|
||||
|
||||
it('should remove the ordered list after pressing backspace', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.clearContent()
|
||||
|
||||
@@ -77,8 +77,8 @@ export const OrderedList = Node.create<OrderedListOptions>({
|
||||
wrappingInputRule(
|
||||
inputRegex,
|
||||
this.type,
|
||||
match => ({ order: +match[1] }),
|
||||
(match, node) => node.childCount + node.attrs.order === +match[1],
|
||||
match => ({ start: +match[1] }),
|
||||
(match, node) => node.childCount + node.attrs.start === +match[1],
|
||||
),
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user