tiptap/docs/api/nodes/task-list.md

53 lines
1.6 KiB
Markdown
Raw Normal View History

---
description: Adds support for tasks (doesnt make sure you actually complete them though).
2021-10-15 03:20:21 +08:00
icon: list-check
---
# TaskList
2021-01-25 17:35:52 +08:00
[![Version](https://img.shields.io/npm/v/@tiptap/extension-task-list.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-task-list)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-task-list.svg)](https://npmcharts.com/compare/@tiptap/extension-task-list?minimal=true)
This extension enables you to use task lists in the editor. They are rendered as `<ul data-type="taskList">`. This implementation doesnt require any framework, its using Vanilla JavaScript only.
Type <code>[ ]&nbsp;</code> or <code>[x]&nbsp;</code> at the beginning of a new line and it will magically transform to a task list.
## Installation
```bash
npm install @tiptap/extension-task-list @tiptap/extension-task-item
```
2021-02-12 22:02:40 +08:00
This extension requires the [`TaskItem`](/api/nodes/task-item) extension.
## Settings
### HTMLAttributes
Custom HTML attributes that should be added to the rendered HTML tag.
```js
TaskList.configure({
HTMLAttributes: {
class: 'my-custom-class',
},
})
```
## Commands
2021-10-02 06:14:44 +08:00
# toggleTaskList()
Toggle a task list.
```js
editor.commands.toggleTaskList()
```
2020-11-19 08:16:10 +08:00
## Keyboard shortcuts
| Command | Windows/Linux | macOS |
| ---------------- | ------------------------------- | --------------------------- |
| toggleTaskList() | `Control`&nbsp;`Shift`&nbsp;`9` | `Cmd`&nbsp;`Shift`&nbsp;`9` |
2020-11-19 08:16:10 +08:00
## Source code
2021-04-21 21:31:11 +08:00
[packages/extension-task-list/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-task-list/)
## Usage
2021-10-19 00:01:47 +08:00
https://embed.tiptap.dev/preview/Nodes/TaskList