Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lexical/list

Package Overview
Dependencies
Maintainers
8
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/list

This package provides the list feature for Lexical.

  • 0.12.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
8
Created

What is @lexical/list?

@lexical/list is a package designed to provide list functionalities within the Lexical framework, a modern web text editor. It allows developers to create, manage, and manipulate ordered and unordered lists in a rich text editor environment.

What are @lexical/list's main functionalities?

Creating Ordered Lists

This feature allows you to create an ordered list (numbered list) within the Lexical editor. The code sample demonstrates how to create a new ordered list node and append it to the editor's root.

import { $createListNode, ListNode } from '@lexical/list';

const orderedListNode = $createListNode('number');
editor.update(() => {
  const root = $getRoot();
  root.append(orderedListNode);
});

Creating Unordered Lists

This feature allows you to create an unordered list (bulleted list) within the Lexical editor. The code sample shows how to create a new unordered list node and append it to the editor's root.

import { $createListNode, ListNode } from '@lexical/list';

const unorderedListNode = $createListNode('bullet');
editor.update(() => {
  const root = $getRoot();
  root.append(unorderedListNode);
});

Converting List Types

This feature allows you to convert an existing list from one type to another (e.g., from ordered to unordered). The code sample demonstrates how to find a list node in the current selection and change its type.

import { $createListNode, ListNode } from '@lexical/list';

editor.update(() => {
  const selection = $getSelection();
  if (selection !== null) {
    const listNode = selection.getNodes().find(node => node instanceof ListNode);
    if (listNode !== null) {
      listNode.setListType('bullet'); // Convert to unordered list
    }
  }
});

Other packages similar to @lexical/list

Keywords

FAQs

Package last updated on 17 Nov 2023

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