Skip to content

Commit

Permalink
Add ListKeymap extension for better list handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rfgamaral committed Aug 17, 2023
1 parent 4cc5386 commit 27cb57d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@tiptap/extension-italic": "2.1.1",
"@tiptap/extension-link": "2.1.1",
"@tiptap/extension-list-item": "2.1.1",
"@tiptap/extension-list-keymap": "2.1.1",
"@tiptap/extension-ordered-list": "2.1.1",
"@tiptap/extension-paragraph": "2.1.1",
"@tiptap/extension-placeholder": "2.1.1",
Expand Down
10 changes: 10 additions & 0 deletions src/extensions/rich-text/rich-text-kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Heading } from '@tiptap/extension-heading'
import { History } from '@tiptap/extension-history'
import { Italic } from '@tiptap/extension-italic'
import { ListItem } from '@tiptap/extension-list-item'
import { ListKeymap } from '@tiptap/extension-list-keymap'
import { OrderedList } from '@tiptap/extension-ordered-list'
import { Paragraph } from '@tiptap/extension-paragraph'
import { Strike } from '@tiptap/extension-strike'
Expand Down Expand Up @@ -135,6 +136,11 @@ type RichTextKitOptions = {
*/
listItem: Partial<ListItemOptions> | false

/**
* Set to `false` to disable the `ListKeymap` extension.
*/
listKeymap: false

/**
* Set options for the `OrderedList` extension, or `false` to disable.
*/
Expand Down Expand Up @@ -299,6 +305,10 @@ const RichTextKit = Extension.create<RichTextKitOptions>({
extensions.push(ListItem.configure(this.options?.listItem))
}

if (this.options.listKeymap !== false) {
extensions.push(ListKeymap)
}

if (this.options.orderedList !== false) {
extensions.push(OrderedList.configure(this.options?.orderedList))
}
Expand Down

0 comments on commit 27cb57d

Please sign in to comment.