fix(lists): bullet-list and ordered-list no longer depend on list-item or text-style extensions #5707 (#5756)

This commit is contained in:
Nick Perez 2024-10-23 11:18:29 +02:00 committed by GitHub
parent cbbb8a5d71
commit 0c9004f2ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 32 deletions

View File

@ -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.

16
package-lock.json generated
View File

@ -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": {

View File

@ -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",

View File

@ -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<BulletListOptions>({
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<BulletListOptions>({
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,
})
}

View File

@ -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",

View File

@ -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<OrderedListOptions>({
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<OrderedListOptions>({
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,
})