mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-08 01:53:04 +08:00
feat(list): add new extension-list
package which packages all the list packages into a single package (#6048)
This maintains backwards-compatibility with the existing packages by making them into re-exports
This commit is contained in:
parent
a0e0dc7597
commit
2c911d2f02
@ -45,7 +45,7 @@ new Editor({
|
||||
|
||||
## Table repackaging
|
||||
|
||||
Since we've moved the code of the table extensions to the `@tiptap/extension-table` package, you can remove the following packages from your project:
|
||||
Since we've moved the code out of the table extensions to the `@tiptap/extension-table` package, you can remove the following packages from your project:
|
||||
|
||||
```bash
|
||||
npm uninstall @tiptap/extension-table-header @tiptap/extension-table-cell @tiptap/extension-table-row
|
||||
|
118
.changeset/seven-llamas-love.md
Normal file
118
.changeset/seven-llamas-love.md
Normal file
@ -0,0 +1,118 @@
|
||||
---
|
||||
'@tiptap/extension-ordered-list': major
|
||||
'@tiptap/extension-bullet-list': major
|
||||
'@tiptap/extension-list-keymap': major
|
||||
'@tiptap/extension-list-item': major
|
||||
'@tiptap/extension-task-list': major
|
||||
---
|
||||
|
||||
This adds all of the list packages to the `@tiptap/extension-list` package.
|
||||
|
||||
## ListKit
|
||||
|
||||
The `ListKit` export allows configuring all list extensions with one extension, and is the recommended way of using the list extensions.
|
||||
|
||||
```ts
|
||||
import { ListKit } from '@tiptap/extension-list'
|
||||
|
||||
new Editor({
|
||||
extensions: [
|
||||
ListKit.configure({
|
||||
bulletList: {
|
||||
HTMLAttributes: 'bullet-list'
|
||||
},
|
||||
orderedList: {
|
||||
HTMLAttributes: 'ordered-list'
|
||||
},
|
||||
listItem: {
|
||||
HTMLAttributes: 'list-item'
|
||||
},
|
||||
taskList: {
|
||||
HTMLAttributes: 'task-list'
|
||||
},
|
||||
taskItem: {
|
||||
HTMLAttributes: 'task-item'
|
||||
},
|
||||
listKeymap: {}
|
||||
}),
|
||||
],
|
||||
})
|
||||
```
|
||||
|
||||
## List repackaging
|
||||
|
||||
Since we've moved the code out of the list extensions to the `@tiptap/extension-list` package, you can remove the following packages from your project:
|
||||
|
||||
```bash
|
||||
npm uninstall @tiptap/extension-ordered-list @tiptap/extension-bullet-list @tiptap/extension-list-keymap @tiptap/extension-list-item @tiptap/extension-task-list
|
||||
```
|
||||
|
||||
And replace them with the new `@tiptap/extension-list` package:
|
||||
|
||||
```bash
|
||||
npm install @tiptap/extension-list
|
||||
```
|
||||
|
||||
## Want to use the extensions separately?
|
||||
|
||||
For more control, you can also use the extensions separately.
|
||||
|
||||
### BulletList
|
||||
|
||||
This extension adds a bullet list to the editor.
|
||||
|
||||
Usage:
|
||||
|
||||
```ts
|
||||
import { BulletList } from '@tiptap/extension-list'
|
||||
```
|
||||
|
||||
### OrderedList
|
||||
|
||||
This extension adds an ordered list to the editor.
|
||||
|
||||
Usage:
|
||||
|
||||
```ts
|
||||
import { OrderedList } from '@tiptap/extension-list'
|
||||
```
|
||||
|
||||
### ListItem
|
||||
|
||||
This extension adds a list item to the editor.
|
||||
|
||||
Usage:
|
||||
|
||||
```ts
|
||||
import { ListItem } from '@tiptap/extension-list'
|
||||
```
|
||||
|
||||
### TaskList
|
||||
|
||||
This extension adds a task list to the editor.
|
||||
|
||||
Usage:
|
||||
|
||||
```ts
|
||||
import { TaskList } from '@tiptap/extension-list'
|
||||
```
|
||||
|
||||
### TaskItem
|
||||
|
||||
This extension adds a task item to the editor.
|
||||
|
||||
Usage:
|
||||
|
||||
```ts
|
||||
import { TaskItem } from '@tiptap/extension-list'
|
||||
```
|
||||
|
||||
### ListKeymap
|
||||
|
||||
This extension adds better default keybindings for lists to the editor.
|
||||
|
||||
Usage:
|
||||
|
||||
```ts
|
||||
import { ListKeymap } from '@tiptap/extension-list'
|
||||
```
|
@ -1,6 +1,5 @@
|
||||
import './styles.scss'
|
||||
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { Color, TextStyle } from '@tiptap/extension-text-style'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
@ -37,20 +36,7 @@ const MenuBar = ({ editor }) => {
|
||||
|
||||
export default () => {
|
||||
const editor = useEditor({
|
||||
extensions: [
|
||||
Color.configure({ types: [TextStyle.name, ListItem.name] }),
|
||||
TextStyle.configure({ types: [ListItem.name] }),
|
||||
StarterKit.configure({
|
||||
bulletList: {
|
||||
keepMarks: true,
|
||||
keepAttributes: false, // TODO : Making this as `false` becase marks are not preserved when I try to preserve attrs, awaiting a bit of help
|
||||
},
|
||||
orderedList: {
|
||||
keepMarks: true,
|
||||
keepAttributes: false, // TODO : Making this as `false` becase marks are not preserved when I try to preserve attrs, awaiting a bit of help
|
||||
},
|
||||
}),
|
||||
],
|
||||
extensions: [Color, TextStyle, StarterKit],
|
||||
content: `
|
||||
<h2>
|
||||
Hi there,
|
||||
|
@ -2,7 +2,6 @@ import './styles.scss'
|
||||
|
||||
import { Image } from '@tiptap/extension-image'
|
||||
import Link from '@tiptap/extension-link'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { Color, TextStyle } from '@tiptap/extension-text-style'
|
||||
import { EditorProvider, useCurrentEditor } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
@ -58,20 +57,7 @@ const MenuBar = () => {
|
||||
)
|
||||
}
|
||||
|
||||
const extensions = [
|
||||
Image,
|
||||
Color.configure({ types: [TextStyle.name, ListItem.name] }),
|
||||
TextStyle.configure({ types: [ListItem.name] }),
|
||||
Link,
|
||||
StarterKit.configure({
|
||||
bulletList: {
|
||||
keepMarks: true,
|
||||
},
|
||||
orderedList: {
|
||||
keepMarks: true,
|
||||
},
|
||||
}),
|
||||
]
|
||||
const extensions = [Image, Color, TextStyle, Link, StarterKit]
|
||||
|
||||
const content = ''
|
||||
|
||||
|
@ -1,25 +1,12 @@
|
||||
import './styles.scss'
|
||||
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import Mentions from '@tiptap/extension-mention'
|
||||
import { Color , TextStyle } from '@tiptap/extension-text-style'
|
||||
import { Color, TextStyle } from '@tiptap/extension-text-style'
|
||||
import { EditorProvider } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import React from 'react'
|
||||
|
||||
const extensions = [
|
||||
Color.configure({ types: [TextStyle.name, ListItem.name] }),
|
||||
TextStyle.configure({ types: [ListItem.name] }),
|
||||
StarterKit.configure({
|
||||
bulletList: {
|
||||
keepMarks: true,
|
||||
},
|
||||
orderedList: {
|
||||
keepMarks: true,
|
||||
},
|
||||
}),
|
||||
Mentions,
|
||||
]
|
||||
const extensions = [Color, TextStyle, StarterKit, Mentions]
|
||||
|
||||
const content = ''
|
||||
|
||||
|
@ -2,8 +2,7 @@ import CharacterCount from '@tiptap/extension-character-count'
|
||||
import Collaboration from '@tiptap/extension-collaboration'
|
||||
import CollaborationCursor from '@tiptap/extension-collaboration-cursor'
|
||||
import Highlight from '@tiptap/extension-highlight'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
|
@ -5,8 +5,7 @@ import CharacterCount from '@tiptap/extension-character-count'
|
||||
import Collaboration from '@tiptap/extension-collaboration'
|
||||
import CollaborationCursor from '@tiptap/extension-collaboration-cursor'
|
||||
import Highlight from '@tiptap/extension-highlight'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
|
@ -27,8 +27,7 @@ import CharacterCount from '@tiptap/extension-character-count'
|
||||
import Collaboration from '@tiptap/extension-collaboration'
|
||||
import CollaborationCursor from '@tiptap/extension-collaboration-cursor'
|
||||
import Highlight from '@tiptap/extension-highlight'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
import * as Y from 'yjs'
|
||||
|
@ -2,7 +2,7 @@
|
||||
import "./styles.scss";
|
||||
|
||||
import { Color } from '@tiptap/extension-text-style'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { ListItem } from '@tiptap/extension-list'
|
||||
import { TextStyle } from '@tiptap/extension-text-style'
|
||||
import StarterKit from "@tiptap/starter-kit";
|
||||
import { Editor } from "@tiptap/core";
|
||||
|
@ -119,7 +119,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { ListItem } from '@tiptap/extension-list'
|
||||
import { Color, TextStyle } from '@tiptap/extension-text-style'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
|
@ -1,13 +1,11 @@
|
||||
import './styles.scss'
|
||||
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { Color, TextStyle } from '@tiptap/extension-text-style'
|
||||
import { EditorProvider, JSONContent, useCurrentEditor, useEditorState } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import { renderToHTMLString, renderToMarkdown, renderToReactElement } from '@tiptap/static-renderer'
|
||||
import React, { useState } from 'react'
|
||||
|
||||
const extensions = [StarterKit, Color.configure({ types: [TextStyle.name, ListItem.name] }), TextStyle]
|
||||
const extensions = [StarterKit]
|
||||
|
||||
const content = `
|
||||
<h2>
|
||||
@ -231,7 +229,6 @@ function MenuBar() {
|
||||
isBlockquote: ctx.editor.isActive('blockquote'),
|
||||
canUndo: ctx.editor.can().chain().focus().undo().run(),
|
||||
canRedo: ctx.editor.can().chain().focus().redo().run(),
|
||||
isPurple: ctx.editor.isActive('textStyle', { color: '#958DF1' }),
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -347,12 +344,6 @@ function MenuBar() {
|
||||
<button onClick={() => editor.chain().focus().redo().run()} disabled={!editorState.canRedo}>
|
||||
Redo
|
||||
</button>
|
||||
<button
|
||||
onClick={() => editor.chain().focus().setColor('#958DF1').run()}
|
||||
className={editorState.isPurple ? 'is-active' : ''}
|
||||
>
|
||||
Purple
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
@ -1,9 +1,8 @@
|
||||
import './styles.scss'
|
||||
|
||||
import Document from '@tiptap/extension-document'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
import React from 'react'
|
||||
|
@ -4,9 +4,8 @@
|
||||
|
||||
<script>
|
||||
import Document from '@tiptap/extension-document'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
|
||||
|
@ -101,7 +101,6 @@
|
||||
<script>
|
||||
import Blockquote from '@tiptap/extension-blockquote'
|
||||
import Bold from '@tiptap/extension-bold'
|
||||
import BulletList from '@tiptap/extension-bullet-list'
|
||||
import Code from '@tiptap/extension-code'
|
||||
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'
|
||||
import Document from '@tiptap/extension-document'
|
||||
@ -112,16 +111,13 @@ import HorizontalRule from '@tiptap/extension-horizontal-rule'
|
||||
import Image from '@tiptap/extension-image'
|
||||
import Italic from '@tiptap/extension-italic'
|
||||
import Link from '@tiptap/extension-link'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { BulletList, ListItem, OrderedList, TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import Mention from '@tiptap/extension-mention'
|
||||
import OrderedList from '@tiptap/extension-ordered-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Strike from '@tiptap/extension-strike'
|
||||
import Subscript from '@tiptap/extension-subscript'
|
||||
import Superscript from '@tiptap/extension-superscript'
|
||||
import { TableKit } from '@tiptap/extension-table'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import TextAlign from '@tiptap/extension-text-align'
|
||||
import { Color, TextStyle } from '@tiptap/extension-text-style'
|
||||
|
@ -1,6 +1,6 @@
|
||||
import './styles.scss'
|
||||
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { ListItem } from '@tiptap/extension-list'
|
||||
import { Color, TextStyle } from '@tiptap/extension-text-style'
|
||||
import { EditorContent, Node, useEditor } from '@tiptap/react'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
|
@ -33,9 +33,8 @@ import Bold from '@tiptap/extension-bold'
|
||||
import Collaboration from '@tiptap/extension-collaboration'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import Heading from '@tiptap/extension-heading'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Dropcursor } from '@tiptap/extensions'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
|
@ -1,9 +1,8 @@
|
||||
import './styles.scss'
|
||||
|
||||
import BulletList from '@tiptap/extension-bullet-list'
|
||||
import Code from '@tiptap/extension-code'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { BulletList, ListItem } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Focus } from '@tiptap/extensions'
|
||||
|
@ -3,10 +3,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BulletList from '@tiptap/extension-bullet-list'
|
||||
import Code from '@tiptap/extension-code'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { BulletList, ListItem } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Focus } from '@tiptap/extensions'
|
||||
|
@ -1,9 +1,7 @@
|
||||
import './styles.scss'
|
||||
|
||||
import BulletList from '@tiptap/extension-bullet-list'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import ListKeymap from '@tiptap/extension-list-keymap'
|
||||
import { BulletList, ListItem, ListKeymap } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
|
@ -1,8 +1,7 @@
|
||||
import './styles.scss'
|
||||
|
||||
import BulletList from '@tiptap/extension-bullet-list'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { BulletList, ListItem } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
|
@ -33,9 +33,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BulletList from '@tiptap/extension-bullet-list'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import { BulletList, ListItem } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
|
@ -1,9 +1,7 @@
|
||||
import './styles.scss'
|
||||
|
||||
import BulletList from '@tiptap/extension-bullet-list'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import OrderedList from '@tiptap/extension-ordered-list'
|
||||
import { BulletList, ListItem, OrderedList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
|
@ -39,10 +39,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BulletList from '@tiptap/extension-bullet-list'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import OrderedList from '@tiptap/extension-ordered-list'
|
||||
import { BulletList, ListItem, OrderedList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
|
@ -1,8 +1,7 @@
|
||||
import './styles.scss'
|
||||
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import OrderedList from '@tiptap/extension-ordered-list'
|
||||
import { ListItem, OrderedList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
|
@ -34,8 +34,7 @@
|
||||
|
||||
<script>
|
||||
import Document from '@tiptap/extension-document'
|
||||
import ListItem from '@tiptap/extension-list-item'
|
||||
import OrderedList from '@tiptap/extension-ordered-list'
|
||||
import { ListItem, OrderedList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
|
@ -1,9 +1,8 @@
|
||||
import './styles.scss'
|
||||
|
||||
import Document from '@tiptap/extension-document'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
import React from 'react'
|
||||
|
@ -34,9 +34,8 @@
|
||||
|
||||
<script>
|
||||
import Document from '@tiptap/extension-document'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
import './styles.scss'
|
||||
|
||||
import Document from '@tiptap/extension-document'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { EditorContent, useEditor } from '@tiptap/react'
|
||||
import React from 'react'
|
||||
|
@ -34,9 +34,8 @@
|
||||
|
||||
<script>
|
||||
import Document from '@tiptap/extension-document'
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
|
||||
|
@ -30,6 +30,7 @@ const getPackageDependencies = () => {
|
||||
name === 'extension-text-style' ||
|
||||
name === 'extension-table' ||
|
||||
name === 'extensions' ||
|
||||
name === 'extension-list' ||
|
||||
name === 'react' ||
|
||||
name === 'vue-2' ||
|
||||
name === 'vue-3'
|
||||
|
@ -31,10 +31,10 @@
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.4"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.1"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { BulletList } from './bullet-list.js'
|
||||
import { BulletList } from '@tiptap/extension-list'
|
||||
|
||||
export * from './bullet-list.js'
|
||||
export { BulletList, BulletListOptions } from '@tiptap/extension-list'
|
||||
|
||||
export default BulletList
|
||||
|
@ -31,10 +31,10 @@
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.4"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.1"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ListItem } from './list-item.js'
|
||||
import { ListItem } from '@tiptap/extension-list'
|
||||
|
||||
export * from './list-item.js'
|
||||
export { ListItem, ListItemOptions } from '@tiptap/extension-list'
|
||||
|
||||
export default ListItem
|
||||
|
@ -31,12 +31,10 @@
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.4",
|
||||
"@tiptap/pm": "^3.0.0-next.4"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.3",
|
||||
"@tiptap/pm": "^3.0.0-next.3"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { ListKeymap } from './list-keymap.js'
|
||||
import { ListKeymap } from '@tiptap/extension-list'
|
||||
|
||||
export * from './list-keymap.js'
|
||||
export * as listHelpers from './listHelpers/index.js'
|
||||
export { listHelpers, ListKeymap, ListKeymapOptions } from '@tiptap/extension-list'
|
||||
|
||||
export default ListKeymap
|
||||
|
1
packages/extension-list/CHANGELOG.md
Normal file
1
packages/extension-list/CHANGELOG.md
Normal file
@ -0,0 +1 @@
|
||||
# Change Log
|
18
packages/extension-list/README.md
Normal file
18
packages/extension-list/README.md
Normal file
@ -0,0 +1,18 @@
|
||||
# @tiptap/extension-list
|
||||
|
||||
[](https://www.npmjs.com/package/@tiptap/extension-list)
|
||||
[](https://npmcharts.com/compare/tiptap?minimal=true)
|
||||
[](https://www.npmjs.com/package/@tiptap/extension-list)
|
||||
[](https://github.com/sponsors/ueberdosis)
|
||||
|
||||
## Introduction
|
||||
|
||||
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as _New York Times_, _The Guardian_ or _Atlassian_.
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation can be found on the [Tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
|
||||
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
106
packages/extension-list/package.json
Normal file
106
packages/extension-list/package.json
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
"name": "@tiptap/extension-list",
|
||||
"description": "List extension for tiptap",
|
||||
"version": "3.0.0-next.4",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
"tiptap extension"
|
||||
],
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": {
|
||||
"import": "./dist/index.d.ts",
|
||||
"require": "./dist/index.d.cts"
|
||||
},
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs"
|
||||
},
|
||||
"./bullet-list": {
|
||||
"types": {
|
||||
"import": "./dist/bullet-list/index.d.ts",
|
||||
"require": "./dist/bullet-list/index.d.cts"
|
||||
},
|
||||
"import": "./dist/bullet-list/index.js",
|
||||
"require": "./dist/bullet-list/index.cjs"
|
||||
},
|
||||
"./item": {
|
||||
"types": {
|
||||
"import": "./dist/item/index.d.ts",
|
||||
"require": "./dist/item/index.d.cts"
|
||||
},
|
||||
"import": "./dist/item/index.js",
|
||||
"require": "./dist/item/index.cjs"
|
||||
},
|
||||
"./keymap": {
|
||||
"types": {
|
||||
"import": "./dist/keymap/index.d.ts",
|
||||
"require": "./dist/keymap/index.d.cts"
|
||||
},
|
||||
"import": "./dist/keymap/index.js",
|
||||
"require": "./dist/keymap/index.cjs"
|
||||
},
|
||||
"./kit": {
|
||||
"types": {
|
||||
"import": "./dist/kit/index.d.ts",
|
||||
"require": "./dist/kit/index.d.cts"
|
||||
},
|
||||
"import": "./dist/kit/index.js",
|
||||
"require": "./dist/kit/index.cjs"
|
||||
},
|
||||
"./ordered-list": {
|
||||
"types": {
|
||||
"import": "./dist/ordered-list/index.d.ts",
|
||||
"require": "./dist/ordered-list/index.d.cts"
|
||||
},
|
||||
"import": "./dist/ordered-list/index.js",
|
||||
"require": "./dist/ordered-list/index.cjs"
|
||||
},
|
||||
"./task-item": {
|
||||
"types": {
|
||||
"import": "./dist/task-item/index.d.ts",
|
||||
"require": "./dist/task-item/index.d.cts"
|
||||
},
|
||||
"import": "./dist/task-item/index.js",
|
||||
"require": "./dist/task-item/index.cjs"
|
||||
},
|
||||
"./task-list": {
|
||||
"types": {
|
||||
"import": "./dist/task-list/index.d.ts",
|
||||
"require": "./dist/task-list/index.d.cts"
|
||||
},
|
||||
"import": "./dist/task-list/index.js",
|
||||
"require": "./dist/task-list/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"src",
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.4",
|
||||
"@tiptap/pm": "^3.0.0-next.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.4",
|
||||
"@tiptap/pm": "^3.0.0-next.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ueberdosis/tiptap",
|
||||
"directory": "packages/extension-list"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
||||
}
|
||||
}
|
@ -47,7 +47,7 @@ declare module '@tiptap/core' {
|
||||
/**
|
||||
* Matches a bullet list to a dash or asterisk.
|
||||
*/
|
||||
export const inputRegex = /^\s*([-+*])\s$/
|
||||
export const bulletListInputRegex = /^\s*([-+*])\s$/
|
||||
|
||||
/**
|
||||
* This extension allows you to create bullet lists.
|
||||
@ -105,13 +105,13 @@ export const BulletList = Node.create<BulletListOptions>({
|
||||
|
||||
addInputRules() {
|
||||
let inputRule = wrappingInputRule({
|
||||
find: inputRegex,
|
||||
find: bulletListInputRegex,
|
||||
type: this.type,
|
||||
})
|
||||
|
||||
if (this.options.keepMarks || this.options.keepAttributes) {
|
||||
inputRule = wrappingInputRule({
|
||||
find: inputRegex,
|
||||
find: bulletListInputRegex,
|
||||
type: this.type,
|
||||
keepMarks: this.options.keepMarks,
|
||||
keepAttributes: this.options.keepAttributes,
|
1
packages/extension-list/src/bullet-list/index.ts
Normal file
1
packages/extension-list/src/bullet-list/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './bullet-list.js'
|
7
packages/extension-list/src/index.ts
Normal file
7
packages/extension-list/src/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export * from './bullet-list/index.js'
|
||||
export * from './item/index.js'
|
||||
export * from './keymap/index.js'
|
||||
export * from './kit/index.js'
|
||||
export * from './ordered-list/index.js'
|
||||
export * from './task-item/index.js'
|
||||
export * from './task-list/index.js'
|
1
packages/extension-list/src/item/index.ts
Normal file
1
packages/extension-list/src/item/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './list-item.js'
|
2
packages/extension-list/src/keymap/index.ts
Normal file
2
packages/extension-list/src/keymap/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './list-keymap.js'
|
||||
export * as listHelpers from './listHelpers/index.js'
|
75
packages/extension-list/src/kit/index.ts
Normal file
75
packages/extension-list/src/kit/index.ts
Normal file
@ -0,0 +1,75 @@
|
||||
import { Extension } from '@tiptap/core'
|
||||
|
||||
import { BulletList, BulletListOptions } from '../bullet-list/index.js'
|
||||
import { ListItem, ListItemOptions } from '../item/index.js'
|
||||
import { ListKeymap, ListKeymapOptions } from '../keymap/index.js'
|
||||
import { OrderedList, OrderedListOptions } from '../ordered-list/index.js'
|
||||
import { TaskItem, TaskItemOptions } from '../task-item/index.js'
|
||||
import { TaskList, TaskListOptions } from '../task-list/index.js'
|
||||
|
||||
export interface ListKitOptions {
|
||||
/**
|
||||
* If set to false, the bulletList extension will not be registered
|
||||
* @example table: false
|
||||
*/
|
||||
bulletList: Partial<BulletListOptions> | false
|
||||
/**
|
||||
* If set to false, the listItem extension will not be registered
|
||||
*/
|
||||
listItem: Partial<ListItemOptions> | false
|
||||
/**
|
||||
* If set to false, the listKeymap extension will not be registered
|
||||
*/
|
||||
listKeymap: Partial<ListKeymapOptions> | false
|
||||
/**
|
||||
* If set to false, the orderedList extension will not be registered
|
||||
*/
|
||||
orderedList: Partial<OrderedListOptions> | false
|
||||
/**
|
||||
* If set to false, the taskItem extension will not be registered
|
||||
*/
|
||||
taskItem: Partial<TaskItemOptions> | false
|
||||
/**
|
||||
* If set to false, the taskList extension will not be registered
|
||||
*/
|
||||
taskList: Partial<TaskListOptions> | false
|
||||
}
|
||||
|
||||
/**
|
||||
* The table kit is a collection of table editor extensions.
|
||||
*
|
||||
* It’s a good starting point for building your own table in Tiptap.
|
||||
*/
|
||||
export const ListKit = Extension.create<ListKitOptions>({
|
||||
name: 'listKit',
|
||||
|
||||
addExtensions() {
|
||||
const extensions = []
|
||||
|
||||
if (this.options.bulletList !== false) {
|
||||
extensions.push(BulletList.configure(this.options.bulletList))
|
||||
}
|
||||
|
||||
if (this.options.listItem !== false) {
|
||||
extensions.push(ListItem.configure(this.options.listItem))
|
||||
}
|
||||
|
||||
if (this.options.listKeymap !== false) {
|
||||
extensions.push(ListKeymap.configure(this.options.listKeymap))
|
||||
}
|
||||
|
||||
if (this.options.orderedList !== false) {
|
||||
extensions.push(OrderedList.configure(this.options.orderedList))
|
||||
}
|
||||
|
||||
if (this.options.taskItem !== false) {
|
||||
extensions.push(TaskItem.configure(this.options.taskItem))
|
||||
}
|
||||
|
||||
if (this.options.taskList !== false) {
|
||||
extensions.push(TaskList.configure(this.options.taskList))
|
||||
}
|
||||
|
||||
return extensions
|
||||
},
|
||||
})
|
1
packages/extension-list/src/ordered-list/index.ts
Normal file
1
packages/extension-list/src/ordered-list/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './ordered-list.js'
|
@ -48,7 +48,7 @@ declare module '@tiptap/core' {
|
||||
/**
|
||||
* Matches an ordered list to a 1. on input (or any number followed by a dot).
|
||||
*/
|
||||
export const inputRegex = /^(\d+)\.\s$/
|
||||
export const orderedListInputRegex = /^(\d+)\.\s$/
|
||||
|
||||
/**
|
||||
* This extension allows you to create ordered lists.
|
||||
@ -129,7 +129,7 @@ export const OrderedList = Node.create<OrderedListOptions>({
|
||||
|
||||
addInputRules() {
|
||||
let inputRule = wrappingInputRule({
|
||||
find: inputRegex,
|
||||
find: orderedListInputRegex,
|
||||
type: this.type,
|
||||
getAttributes: match => ({ start: +match[1] }),
|
||||
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
||||
@ -137,7 +137,7 @@ export const OrderedList = Node.create<OrderedListOptions>({
|
||||
|
||||
if (this.options.keepMarks || this.options.keepAttributes) {
|
||||
inputRule = wrappingInputRule({
|
||||
find: inputRegex,
|
||||
find: orderedListInputRegex,
|
||||
type: this.type,
|
||||
keepMarks: this.options.keepMarks,
|
||||
keepAttributes: this.options.keepAttributes,
|
1
packages/extension-list/src/task-item/index.ts
Normal file
1
packages/extension-list/src/task-item/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './task-item.js'
|
1
packages/extension-list/src/task-list/index.ts
Normal file
1
packages/extension-list/src/task-list/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './task-list.js'
|
22
packages/extension-list/tsup.config.ts
Normal file
22
packages/extension-list/tsup.config.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { defineConfig } from 'tsup'
|
||||
|
||||
export default defineConfig(
|
||||
[
|
||||
'src/bullet-list/index.ts',
|
||||
'src/item/index.ts',
|
||||
'src/keymap/index.ts',
|
||||
'src/kit/index.ts',
|
||||
'src/ordered-list/index.ts',
|
||||
'src/task-item/index.ts',
|
||||
'src/task-list/index.ts',
|
||||
'src/index.ts',
|
||||
].map(entry => ({
|
||||
entry: [entry],
|
||||
tsconfig: '../../tsconfig.build.json',
|
||||
outDir: `dist${entry.replace('src', '').split('/').slice(0, -1).join('/')}`,
|
||||
dts: true,
|
||||
sourcemap: true,
|
||||
format: ['esm', 'cjs'],
|
||||
external: [/^[^./]/],
|
||||
})),
|
||||
)
|
@ -31,10 +31,10 @@
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.4"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.1"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { OrderedList } from './ordered-list.js'
|
||||
import { OrderedList } from '@tiptap/extension-list'
|
||||
|
||||
export * from './ordered-list.js'
|
||||
export { OrderedList, OrderedListOptions } from '@tiptap/extension-list'
|
||||
|
||||
export default OrderedList
|
||||
|
@ -31,12 +31,10 @@
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.4",
|
||||
"@tiptap/pm": "^3.0.0-next.4"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.1",
|
||||
"@tiptap/pm": "^3.0.0-next.1"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { TaskItem } from './task-item.js'
|
||||
import { TaskItem } from '@tiptap/extension-list'
|
||||
|
||||
export * from './task-item.js'
|
||||
export { TaskItem, TaskItemOptions } from '@tiptap/extension-list'
|
||||
|
||||
export default TaskItem
|
||||
|
@ -31,10 +31,10 @@
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.4"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^3.0.0-next.1"
|
||||
"@tiptap/extension-list": "^3.0.0-next.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { TaskList } from './task-list.js'
|
||||
import { TaskList } from '@tiptap/extension-list'
|
||||
|
||||
export * from './task-list.js'
|
||||
export { TaskList, TaskListOptions } from '@tiptap/extension-list'
|
||||
|
||||
export default TaskList
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { Extension } from '@tiptap/core'
|
||||
import { Blockquote, BlockquoteOptions } from '@tiptap/extension-blockquote'
|
||||
import { Bold, BoldOptions } from '@tiptap/extension-bold'
|
||||
import { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list'
|
||||
import { Code, CodeOptions } from '@tiptap/extension-code'
|
||||
import { CodeBlock, CodeBlockOptions } from '@tiptap/extension-code-block'
|
||||
import { Document } from '@tiptap/extension-document'
|
||||
@ -10,9 +9,16 @@ import { Heading, HeadingOptions } from '@tiptap/extension-heading'
|
||||
import { HorizontalRule, HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule'
|
||||
import { Italic, ItalicOptions } from '@tiptap/extension-italic'
|
||||
import { Link, LinkOptions } from '@tiptap/extension-link'
|
||||
import { ListItem, ListItemOptions } from '@tiptap/extension-list-item'
|
||||
import { ListKeymap, ListKeymapOptions } from '@tiptap/extension-list-keymap'
|
||||
import { OrderedList, OrderedListOptions } from '@tiptap/extension-ordered-list'
|
||||
import {
|
||||
BulletList,
|
||||
BulletListOptions,
|
||||
ListItem,
|
||||
ListItemOptions,
|
||||
ListKeymap,
|
||||
ListKeymapOptions,
|
||||
OrderedList,
|
||||
OrderedListOptions,
|
||||
} from '@tiptap/extension-list'
|
||||
import { Paragraph, ParagraphOptions } from '@tiptap/extension-paragraph'
|
||||
import { Strike, StrikeOptions } from '@tiptap/extension-strike'
|
||||
import { Text } from '@tiptap/extension-text'
|
||||
|
@ -331,9 +331,9 @@ importers:
|
||||
|
||||
packages/extension-bullet-list:
|
||||
devDependencies:
|
||||
'@tiptap/core':
|
||||
'@tiptap/extension-list':
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../core
|
||||
version: link:../extension-list
|
||||
|
||||
packages/extension-character-count:
|
||||
devDependencies:
|
||||
@ -512,13 +512,7 @@ importers:
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../pm
|
||||
|
||||
packages/extension-list-item:
|
||||
devDependencies:
|
||||
'@tiptap/core':
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../core
|
||||
|
||||
packages/extension-list-keymap:
|
||||
packages/extension-list:
|
||||
devDependencies:
|
||||
'@tiptap/core':
|
||||
specifier: ^3.0.0-next.4
|
||||
@ -527,6 +521,18 @@ importers:
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../pm
|
||||
|
||||
packages/extension-list-item:
|
||||
devDependencies:
|
||||
'@tiptap/extension-list':
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../extension-list
|
||||
|
||||
packages/extension-list-keymap:
|
||||
devDependencies:
|
||||
'@tiptap/extension-list':
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../extension-list
|
||||
|
||||
packages/extension-mention:
|
||||
devDependencies:
|
||||
'@tiptap/core':
|
||||
@ -541,9 +547,9 @@ importers:
|
||||
|
||||
packages/extension-ordered-list:
|
||||
devDependencies:
|
||||
'@tiptap/core':
|
||||
'@tiptap/extension-list':
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../core
|
||||
version: link:../extension-list
|
||||
|
||||
packages/extension-paragraph:
|
||||
devDependencies:
|
||||
@ -610,18 +616,15 @@ importers:
|
||||
|
||||
packages/extension-task-item:
|
||||
devDependencies:
|
||||
'@tiptap/core':
|
||||
'@tiptap/extension-list':
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../core
|
||||
'@tiptap/pm':
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../pm
|
||||
version: link:../extension-list
|
||||
|
||||
packages/extension-task-list:
|
||||
devDependencies:
|
||||
'@tiptap/core':
|
||||
'@tiptap/extension-list':
|
||||
specifier: ^3.0.0-next.4
|
||||
version: link:../core
|
||||
version: link:../extension-list
|
||||
|
||||
packages/extension-text:
|
||||
devDependencies:
|
||||
|
Loading…
Reference in New Issue
Block a user