mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 23:15:15 +08:00
fix broken document
This commit is contained in:
parent
2bc02e50e0
commit
a5d1c76f40
@ -1,5 +1,6 @@
|
||||
import { Extensions } from '../types'
|
||||
import splitExtensions from './splitExtensions'
|
||||
import callOrReturn from './callOrReturn'
|
||||
|
||||
export default function isList(name: string, extensions: Extensions) {
|
||||
const { nodeExtensions } = splitExtensions(extensions)
|
||||
@ -9,5 +10,11 @@ export default function isList(name: string, extensions: Extensions) {
|
||||
return false
|
||||
}
|
||||
|
||||
return extension.group === 'list'
|
||||
const groups = callOrReturn(extension.group, { options: extension.options })
|
||||
|
||||
if (typeof groups !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
return groups.split(' ').includes('list')
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ export const inputRegex = /^\s*([-+*])\s$/
|
||||
const BulletList = createNode({
|
||||
name: 'bullet_list',
|
||||
|
||||
group: 'list',
|
||||
group: 'block list',
|
||||
|
||||
content: 'list_item+',
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { createNode } from '@tiptap/core'
|
||||
const Document = createNode({
|
||||
name: 'document',
|
||||
topNode: true,
|
||||
content: '(block|list)+',
|
||||
content: 'block+',
|
||||
})
|
||||
|
||||
export default Document
|
||||
|
@ -3,7 +3,7 @@ import { createNode } from '@tiptap/core'
|
||||
const ListItem = createNode({
|
||||
name: 'list_item',
|
||||
|
||||
content: '(paragraph|list)+',
|
||||
content: '(paragraph|list?)+',
|
||||
|
||||
defining: true,
|
||||
|
||||
|
@ -6,7 +6,7 @@ export const inputRegex = /^(\d+)\.\s$/
|
||||
const OrderedList = createNode({
|
||||
name: 'ordered_list',
|
||||
|
||||
group: 'list',
|
||||
group: 'block list',
|
||||
|
||||
content: 'list_item+',
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { Command, createNode, mergeAttributes } from '@tiptap/core'
|
||||
const TaskList = createNode({
|
||||
name: 'task_list',
|
||||
|
||||
group: 'list',
|
||||
group: 'block list',
|
||||
|
||||
content: 'task_item+',
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user