From a5d1c76f4038b558863f2a3033dfb2c26725d6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 2 Nov 2020 15:18:03 +0100 Subject: [PATCH] fix broken document --- packages/core/src/utils/isList.ts | 9 ++++++++- packages/extension-bullet-list/index.ts | 2 +- packages/extension-document/index.ts | 2 +- packages/extension-list-item/index.ts | 2 +- packages/extension-ordered-list/index.ts | 2 +- packages/extension-task-list/index.ts | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/core/src/utils/isList.ts b/packages/core/src/utils/isList.ts index 5c169e4fc..860e3f64f 100644 --- a/packages/core/src/utils/isList.ts +++ b/packages/core/src/utils/isList.ts @@ -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') } diff --git a/packages/extension-bullet-list/index.ts b/packages/extension-bullet-list/index.ts index db615f6e9..66ec461bb 100644 --- a/packages/extension-bullet-list/index.ts +++ b/packages/extension-bullet-list/index.ts @@ -6,7 +6,7 @@ export const inputRegex = /^\s*([-+*])\s$/ const BulletList = createNode({ name: 'bullet_list', - group: 'list', + group: 'block list', content: 'list_item+', diff --git a/packages/extension-document/index.ts b/packages/extension-document/index.ts index 0a05a1ff0..d569b12f9 100644 --- a/packages/extension-document/index.ts +++ b/packages/extension-document/index.ts @@ -3,7 +3,7 @@ import { createNode } from '@tiptap/core' const Document = createNode({ name: 'document', topNode: true, - content: '(block|list)+', + content: 'block+', }) export default Document diff --git a/packages/extension-list-item/index.ts b/packages/extension-list-item/index.ts index a36a95be9..aa267107a 100644 --- a/packages/extension-list-item/index.ts +++ b/packages/extension-list-item/index.ts @@ -3,7 +3,7 @@ import { createNode } from '@tiptap/core' const ListItem = createNode({ name: 'list_item', - content: '(paragraph|list)+', + content: '(paragraph|list?)+', defining: true, diff --git a/packages/extension-ordered-list/index.ts b/packages/extension-ordered-list/index.ts index 779529513..35c7ac92d 100644 --- a/packages/extension-ordered-list/index.ts +++ b/packages/extension-ordered-list/index.ts @@ -6,7 +6,7 @@ export const inputRegex = /^(\d+)\.\s$/ const OrderedList = createNode({ name: 'ordered_list', - group: 'list', + group: 'block list', content: 'list_item+', diff --git a/packages/extension-task-list/index.ts b/packages/extension-task-list/index.ts index d1e8a1f5c..b4e0cb831 100644 --- a/packages/extension-task-list/index.ts +++ b/packages/extension-task-list/index.ts @@ -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+',