What is @tiptap/extension-list-item?
@tiptap/extension-list-item is an extension for the Tiptap editor that provides functionality for working with list items. It allows you to create, manipulate, and manage list items within your rich text editor, supporting both ordered and unordered lists.
What are @tiptap/extension-list-item's main functionalities?
Creating List Items
This code demonstrates how to include the ListItem extension in a Tiptap editor instance, enabling the creation of list items.
import { ListItem } from '@tiptap/extension-list-item';
const editor = new Editor({
extensions: [
ListItem,
],
});
Nested List Items
This code shows how to initialize the editor with nested list items, demonstrating the extension's capability to handle nested lists.
import { ListItem } from '@tiptap/extension-list-item';
const editor = new Editor({
extensions: [
ListItem,
],
content: '<ul><li>Item 1<ul><li>Nested Item 1</li></ul></li></ul>',
});
Toggling List Items
This code snippet demonstrates how to toggle a list item using the chainable commands provided by Tiptap.
import { ListItem } from '@tiptap/extension-list-item';
const editor = new Editor({
extensions: [
ListItem,
],
});
// Toggle a list item
editor.chain().focus().toggleListItem().run();
Other packages similar to @tiptap/extension-list-item
prosemirror-schema-list
prosemirror-schema-list is a ProseMirror schema extension that provides list item functionality similar to @tiptap/extension-list-item. It allows for the creation and manipulation of ordered and unordered lists within a ProseMirror editor. While it offers similar core functionalities, it requires more manual setup compared to the seamless integration provided by Tiptap extensions.
draft-js-list-plugin
draft-js-list-plugin is a plugin for Draft.js that adds support for list items. It allows users to create and manage ordered and unordered lists within a Draft.js editor. Compared to @tiptap/extension-list-item, it is specific to Draft.js and may require additional configuration to achieve similar functionality.
quill-better-table
quill-better-table is a Quill.js module that enhances table functionality, including support for list items within table cells. While it is not solely focused on list items, it provides similar list management capabilities within the context of tables. It is more specialized compared to the general list item support offered by @tiptap/extension-list-item.