fix broken document

This commit is contained in:
Philipp Kühn 2020-11-02 15:18:03 +01:00
parent 2bc02e50e0
commit a5d1c76f40
6 changed files with 13 additions and 6 deletions

View File

@ -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')
}

View File

@ -6,7 +6,7 @@ export const inputRegex = /^\s*([-+*])\s$/
const BulletList = createNode({
name: 'bullet_list',
group: 'list',
group: 'block list',
content: 'list_item+',

View File

@ -3,7 +3,7 @@ import { createNode } from '@tiptap/core'
const Document = createNode({
name: 'document',
topNode: true,
content: '(block|list)+',
content: 'block+',
})
export default Document

View File

@ -3,7 +3,7 @@ import { createNode } from '@tiptap/core'
const ListItem = createNode({
name: 'list_item',
content: '(paragraph|list)+',
content: '(paragraph|list?)+',
defining: true,

View File

@ -6,7 +6,7 @@ export const inputRegex = /^(\d+)\.\s$/
const OrderedList = createNode({
name: 'ordered_list',
group: 'list',
group: 'block list',
content: 'list_item+',

View File

@ -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+',