Socket
Socket
Sign inDemoInstall

@tiptap/extension-task-list

Package Overview
Dependencies
Maintainers
4
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-task-list

task list extension for tiptap


Version published
Weekly downloads
181K
decreased by-14.56%
Maintainers
4
Weekly downloads
 
Created

What is @tiptap/extension-task-list?

@tiptap/extension-task-list is an extension for the Tiptap editor that allows you to add and manage task lists within your rich text editor. It provides functionality to create, edit, and manage task lists, making it easier to handle to-do lists and similar content within your editor.

What are @tiptap/extension-task-list's main functionalities?

Create Task List

This code demonstrates how to create a task list using the @tiptap/extension-task-list package. It initializes the Tiptap editor with the TaskList and TaskItem extensions and sets the initial content to a task list with two items.

import TaskList from '@tiptap/extension-task-list';
import TaskItem from '@tiptap/extension-task-item';
import { Editor } from '@tiptap/core';

const editor = new Editor({
  extensions: [
    TaskList,
    TaskItem,
  ],
  content: '<ul data-type="taskList"><li data-checked="false">Task 1</li><li data-checked="true">Task 2</li></ul>',
});

Toggle Task Completion

This code demonstrates how to toggle the completion status of a task item within a task list. The `toggleTaskItem` method is used to change the checked state of a task item.

editor.chain().focus().toggleTaskItem({ id: 'task-item-id' }).run();

Add New Task Item

This code demonstrates how to add a new task item to an existing task list. The `insertContent` method is used to insert a new task item with the specified content.

editor.chain().focus().insertContent('<li data-type="taskItem" data-checked="false">New Task</li>').run();
0

Keywords

FAQs

Package last updated on 23 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc