From 0c9004f2ca2a85ff97cb70d22f840a818817055e Mon Sep 17 00:00:00 2001 From: Nick Perez Date: Wed, 23 Oct 2024 11:18:29 +0200 Subject: [PATCH] fix(lists): bullet-list and ordered-list no longer depend on list-item or text-style extensions #5707 (#5756) --- .changeset/light-pens-end.md | 6 ++++++ package-lock.json | 16 ++++------------ packages/extension-bullet-list/package.json | 8 ++------ .../extension-bullet-list/src/bullet-list.ts | 9 +++++---- packages/extension-ordered-list/package.json | 8 ++------ .../extension-ordered-list/src/ordered-list.ts | 9 +++++---- 6 files changed, 24 insertions(+), 32 deletions(-) create mode 100644 .changeset/light-pens-end.md diff --git a/.changeset/light-pens-end.md b/.changeset/light-pens-end.md new file mode 100644 index 00000000000..eaaaad62888 --- /dev/null +++ b/.changeset/light-pens-end.md @@ -0,0 +1,6 @@ +--- +"@tiptap/extension-ordered-list": patch +"@tiptap/extension-bullet-list": patch +--- + +This resolves an issue where the bullet-list and ordered-list extensions were depending on the list-item and text-style extensions unneccesarily. They are no longer imported and constants are used instead. diff --git a/package-lock.json b/package-lock.json index bcdab7d710b..54a47978f94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18917,18 +18917,14 @@ "version": "2.9.0", "license": "MIT", "devDependencies": { - "@tiptap/core": "^2.9.0", - "@tiptap/extension-list-item": "^2.9.0", - "@tiptap/extension-text-style": "^2.9.0" + "@tiptap/core": "^2.9.0" }, "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" }, "peerDependencies": { - "@tiptap/core": "^2.7.0", - "@tiptap/extension-list-item": "^2.7.0", - "@tiptap/extension-text-style": "^2.7.0" + "@tiptap/core": "^2.7.0" } }, "packages/extension-character-count": { @@ -19391,18 +19387,14 @@ "version": "2.9.0", "license": "MIT", "devDependencies": { - "@tiptap/core": "^2.9.0", - "@tiptap/extension-list-item": "^2.9.0", - "@tiptap/extension-text-style": "^2.9.0" + "@tiptap/core": "^2.9.0" }, "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" }, "peerDependencies": { - "@tiptap/core": "^2.7.0", - "@tiptap/extension-list-item": "^2.7.0", - "@tiptap/extension-text-style": "^2.7.0" + "@tiptap/core": "^2.7.0" } }, "packages/extension-paragraph": { diff --git a/packages/extension-bullet-list/package.json b/packages/extension-bullet-list/package.json index 93ad69dcf6c..012ca2c5fff 100644 --- a/packages/extension-bullet-list/package.json +++ b/packages/extension-bullet-list/package.json @@ -29,14 +29,10 @@ "dist" ], "devDependencies": { - "@tiptap/core": "^2.9.0", - "@tiptap/extension-list-item": "^2.9.0", - "@tiptap/extension-text-style": "^2.9.0" + "@tiptap/core": "^2.9.0" }, "peerDependencies": { - "@tiptap/core": "^2.7.0", - "@tiptap/extension-list-item": "^2.7.0", - "@tiptap/extension-text-style": "^2.7.0" + "@tiptap/core": "^2.7.0" }, "repository": { "type": "git", diff --git a/packages/extension-bullet-list/src/bullet-list.ts b/packages/extension-bullet-list/src/bullet-list.ts index 63ff3f23714..320d3abf402 100644 --- a/packages/extension-bullet-list/src/bullet-list.ts +++ b/packages/extension-bullet-list/src/bullet-list.ts @@ -1,6 +1,7 @@ import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core' -import { ListItem } from '@tiptap/extension-list-item' -import { TextStyle } from '@tiptap/extension-text-style' + +const ListItemName = 'listItem' +const TextStyleName = 'textStyle' export interface BulletListOptions { /** @@ -86,7 +87,7 @@ export const BulletList = Node.create({ return { toggleBulletList: () => ({ commands, chain }) => { if (this.options.keepAttributes) { - return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run() + return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run() } return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) }, @@ -111,7 +112,7 @@ export const BulletList = Node.create({ type: this.type, keepMarks: this.options.keepMarks, keepAttributes: this.options.keepAttributes, - getAttributes: () => { return this.editor.getAttributes(TextStyle.name) }, + getAttributes: () => { return this.editor.getAttributes(TextStyleName) }, editor: this.editor, }) } diff --git a/packages/extension-ordered-list/package.json b/packages/extension-ordered-list/package.json index f8e23898dd0..16d80b8ea47 100644 --- a/packages/extension-ordered-list/package.json +++ b/packages/extension-ordered-list/package.json @@ -29,14 +29,10 @@ "dist" ], "devDependencies": { - "@tiptap/core": "^2.9.0", - "@tiptap/extension-list-item": "^2.9.0", - "@tiptap/extension-text-style": "^2.9.0" + "@tiptap/core": "^2.9.0" }, "peerDependencies": { - "@tiptap/core": "^2.7.0", - "@tiptap/extension-list-item": "^2.7.0", - "@tiptap/extension-text-style": "^2.7.0" + "@tiptap/core": "^2.7.0" }, "repository": { "type": "git", diff --git a/packages/extension-ordered-list/src/ordered-list.ts b/packages/extension-ordered-list/src/ordered-list.ts index d4cf1c4720a..950ac92ccc7 100644 --- a/packages/extension-ordered-list/src/ordered-list.ts +++ b/packages/extension-ordered-list/src/ordered-list.ts @@ -1,6 +1,7 @@ import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core' -import { ListItem } from '@tiptap/extension-list-item' -import { TextStyle } from '@tiptap/extension-text-style' + +const ListItemName = 'listItem' +const TextStyleName = 'textStyle' export interface OrderedListOptions { /** @@ -110,7 +111,7 @@ export const OrderedList = Node.create({ return { toggleOrderedList: () => ({ commands, chain }) => { if (this.options.keepAttributes) { - return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run() + return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run() } return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) }, @@ -137,7 +138,7 @@ export const OrderedList = Node.create({ type: this.type, keepMarks: this.options.keepMarks, keepAttributes: this.options.keepAttributes, - getAttributes: match => ({ start: +match[1], ...this.editor.getAttributes(TextStyle.name) }), + getAttributes: match => ({ start: +match[1], ...this.editor.getAttributes(TextStyleName) }), joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1], editor: this.editor, })