fix: Ordered list start support broke in #3541 (#3833)

* fix: #3831

* fix: default attribute + predicate
This commit is contained in:
Hari Haran 2023-03-19 03:44:01 +05:30 committed by GitHub
parent 928bd36f5f
commit 3937c44c43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,6 +91,8 @@ export const OrderedList = Node.create<OrderedListOptions>({
let inputRule = wrappingInputRule({
find: inputRegex,
type: this.type,
getAttributes: match => ({ start: +match[1] }),
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
})
if (this.options.keepMarks || this.options.keepAttributes) {
@ -99,7 +101,8 @@ export const OrderedList = Node.create<OrderedListOptions>({
type: this.type,
keepMarks: this.options.keepMarks,
keepAttributes: this.options.keepAttributes,
getAttributes: () => { return this.editor.getAttributes(TextStyle.name) },
getAttributes: match => ({ start: +match[1], ...this.editor.getAttributes(TextStyle.name) }),
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
editor: this.editor,
})
}