N°654
REPOSITORY DETAIL · 仓库详情
Open Source · GITHUB
lexical – facebook
facebook/lexical
开发框架 / 工具库
23,759 Stars
2,217 Forks
TypeScript
MIT
2
Views · 浏览
项目简介
Lexical 是一个可扩展的文本编辑器框架,提供出色的可靠性、可访问性和性能。
SECTION · 01
关键指标一览
Stars 数
23,759
Forks 数
2,217
Watchers 数
23,759
Issue 数
348
主要语言
TypeScript
许可证
MIT
仓库所有者
facebook
创建时间
2020.12.03
更新时间
2026.08.13
最近推送
2026.08.13
SECTION · 03
README 详细介绍
README 原文为英文,如需阅读完整中文内容,建议使用 浏览器翻译插件(如 Edge 浏览器自带翻译、Google 翻译扩展)进行整页翻译。
An extensible text editor framework that provides excellent reliability, accessibility and performance.
Documentation | Getting Started | Playground | Gallery
Features
- Framework Agnostic Core - Works with any UI framework, with official React bindings
- Reliable & Accessible - Built-in accessibility support and WCAG compliance
- Extensible - Plugin-based architecture with powerful extension points
- Immutable State Model - Time-travel ready with built-in undo/redo
- Collaborative Editing - Real-time collaboration via Yjs integration
- Serialization - Import/export from JSON, Markdown, and HTML
- Rich Content - Support for tables, lists, code blocks, images, and custom nodes
- Cross-browser - Firefox 115+, Safari 15+, Chrome 86+ (see Supported Browsers)
- Type Safe - Written in TypeScript with comprehensive type definitions
Quick Start
npm install lexical @lexical/react
import { $getRoot, $getSelection } from 'lexical';
import { LexicalComposer } from '@lexical/react/LexicalComposer';
import { PlainTextPlugin } from '@lexical/react/LexicalPlainTextPlugin';
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
const initialConfig = {
namespace: 'MyEditor',
onError: (error) => console.error(error),
};
function Editor() {
return (
<LexicalComposer initialConfig={initialConfig}>
<PlainTextPlugin
contentEditable={<ContentEditable />}
ErrorBoundary={LexicalErrorBoundary}
/>
<HistoryPlugin />
</LexicalComposer>
);
}
Try it yourself:
Development
# Install dependencies
pnpm install
# Start playground dev server
pnpm run start
# Run tests
pnpm run test-unit
pnpm run test-e2e-chromium
# Lint and type check
pnpm run ci-check
See CONTRIBUTING.md for detailed development guidelines.
Documentation
- User Guide: lexical.dev/docs/intro
- API Reference: lexical.dev/docs/api
- Developer Guide: AGENTS.md - Architecture and development workflows
- Examples: examples/ - Sample implementations
Community & Support
- Discord: Join our Discord server for announcements, questions, discussions
- Issues: Report bugs and request features on GitHub Issues
- Release Notes: Release notes are available in Github Releases
Browser Support
| Browser | Version |
|---|---|
| Chrome | 86+ |
| Firefox | 115+ |
| Safari | 15+ |
| Edge | 86+ |
We welcome contributions! Please read our Contributing Guide to learn about our development process and how to propose bugfixes and improvements.
License
MIT License Copyright ©2026 Meta Platforms, Inc.
已复制克隆地址到剪贴板