mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 14:59:27 +08:00
fix(lists): bullet-list and ordered-list no longer depend on list-item or text-style extensions #5707 (#5756)
This commit is contained in:
parent
cbbb8a5d71
commit
0c9004f2ca
6
.changeset/light-pens-end.md
Normal file
6
.changeset/light-pens-end.md
Normal 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
16
package-lock.json
generated
@ -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": {
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user