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 { Extensions } from '../types'
import splitExtensions from './splitExtensions' import splitExtensions from './splitExtensions'
import callOrReturn from './callOrReturn'
export default function isList(name: string, extensions: Extensions) { export default function isList(name: string, extensions: Extensions) {
const { nodeExtensions } = splitExtensions(extensions) const { nodeExtensions } = splitExtensions(extensions)
@ -9,5 +10,11 @@ export default function isList(name: string, extensions: Extensions) {
return false 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({ const BulletList = createNode({
name: 'bullet_list', name: 'bullet_list',
group: 'list', group: 'block list',
content: 'list_item+', content: 'list_item+',

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@ import { Command, createNode, mergeAttributes } from '@tiptap/core'
const TaskList = createNode({ const TaskList = createNode({
name: 'task_list', name: 'task_list',
group: 'list', group: 'block list',
content: 'task_item+', content: 'task_item+',