Gathering detailed insights and metrics for slate
Gathering detailed insights and metrics for slate
Gathering detailed insights and metrics for slate
Gathering detailed insights and metrics for slate
A completely customizable framework for building rich text editors. (Currently in beta.)
npm install slate
slate-dom@0.111.0
Published on 01 Nov 2024
slate-react@0.111.0
Published on 01 Nov 2024
slate-react@0.110.3
Published on 24 Oct 2024
slate-history@0.110.3
Published on 24 Oct 2024
slate-react@0.110.2
Published on 17 Oct 2024
slate@0.110.2
Published on 17 Oct 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
30,014 Stars
4,202 Commits
3,256 Forks
305 Watching
48 Branches
577 Contributors
Updated on 28 Nov 2024
Minified
Minified + Gzipped
TypeScript (84.71%)
JavaScript (15.15%)
CSS (0.14%)
Cumulative downloads
Total Downloads
Last day
-11%
176,382
Compared to previous day
Last week
5.5%
1,029,471
Compared to previous week
Last month
10.7%
4,223,973
Compared to previous month
Last year
44.9%
40,600,370
Compared to previous year
3
4
A completely customizable framework
for building rich text editors.
Why? · Principles · Demo · Examples · Documentation · Contributing!
Slate lets you build rich, intuitive editors like those in Medium, Dropbox Paper or Google Docs—which are becoming table stakes for applications on the web—without your codebase getting mired in complexity.
It can do this because all of its logic is implemented with a series of plugins, so you aren't ever constrained by what is or isn't in "core". You can think of it like a pluggable implementation of contenteditable
built on top of React. It was inspired by libraries like Draft.js, Prosemirror and Quill.
🤖 Slate is currently in beta. Its core API is useable right now, but you might need to pull request improvements for advanced use cases, or fixes for some bugs. Some of its APIs are not "finalized" and will have breaking changes over time as we discover better solutions. There isn't currently a
1.0
release schedule, we're still getting the architecture right.
🤖 Slate is also contributor-driven. It is not backed by any huge company, which means that all contributions are voluntary and done by the people who need them. If you need something improved, added, or fixed, please contribute it yourself or no one will. And if you want to become a more active maintainer, let us know in the Slack channel.
Why create Slate? Well... (Beware: this section has a few of my opinions!)
Before creating Slate, I tried a lot of the other rich text libraries out there—Draft.js, Prosemirror, Quill, etc. What I found was that while getting simple examples to work was easy enough, once you started trying to build something like Medium, Dropbox Paper or Google Docs, you ran into deeper issues...
The editor's "schema" was hardcoded and hard to customize. Things like bold and italic were supported out of the box, but what about comments, or embeds, or even more domain-specific needs?
Transforming the documents programmatically was very convoluted. Writing as a user may have worked, but making programmatic changes, which is critical for building advanced behaviors, was needlessly complex.
Serializing to HTML, Markdown, etc. seemed like an afterthought. Simple things like transforming a document to HTML or Markdown involved writing lots of boilerplate code, for what seemed like very common use cases.
Re-inventing the view layer seemed inefficient and limiting. Most editors rolled their own views, instead of using existing technologies like React, so you have to learn a whole new system with new "gotchas".
Collaborative editing wasn't designed for in advance. Often the editor's internal representation of data made it impossible to use to for a realtime, collaborative editing use case without basically rewriting the editor.
The repositories were monolithic, not small and reusable. The code bases for many of the editors often didn't expose the internal tooling that could have been re-used by developers, leading to having to reinvent the wheel.
Building complex, nested documents was impossible. Many editors were designed around simplistic "flat" documents, making things like tables, embeds and captions difficult to reason about and sometimes impossible.
Of course not every editor exhibits all of these issues, but if you've tried using another editor you might have run into similar problems. To get around the limitations of their API's and achieve the user experience you're after, you have to resort to very hacky things. And some experiences are just plain impossible to achieve.
If that sounds familiar, you might like Slate.
Which brings me to how Slate solves all of that...
Slate tries to solve the question of "Why?" with a few principles:
First-class plugins. The most important part of Slate is that plugins are first-class entities. That means you can completely customize the editing experience, to build complex editors like Medium's or Dropbox's, without having to fight against the library's assumptions.
Schema-less core. Slate's core logic assumes very little about the schema of the data you'll be editing, which means that there are no assumptions baked into the library that'll trip you up when you need to go beyond the most basic use cases.
Nested document model. The document model used for Slate is a nested, recursive tree, just like the DOM itself. This means that creating complex components like tables or nested block quotes are possible for advanced use cases. But it's also easy to keep it simple by only using a single level of hierarchy.
Parallel to the DOM. Slate's data model is based on the DOM—the document is a nested tree, it uses selections and ranges, and it exposes all the standard event handlers. This means that advanced behaviors like tables or nested block quotes are possible. Pretty much anything you can do in the DOM, you can do in Slate.
Intuitive commands. Slate documents are edited using "commands", that are designed to be high-level and extremely intuitive to write and read, so that custom functionality is as expressive as possible. This greatly increases your ability to reason about your code.
Collaboration-ready data model. The data model Slate uses—specifically how operations are applied to the document—has been designed to allow for collaborative editing to be layered on top, so you won't need to rethink everything if you decide to make your editor collaborative.
Clear "core" boundaries. With a plugin-first architecture, and a schema-less core, it becomes a lot clearer where the boundary is between "core" and "custom", which means that the core experience doesn't get bogged down in edge cases.
Check out the live demo of all of the examples!
To get a sense for how you might use Slate, check out a few of the examples:
<textarea>
.If you have an idea for an example that shows a common use case, pull request it!
If you're using Slate for the first time, check out the Getting Started walkthroughs and the Concepts to familiarize yourself with Slate's architecture and mental models.
If even that's not enough, you can always read the source itself, which is heavily commented.
There are also translations of the documentation into other languages:
If you're maintaining a translation, feel free to pull request it here!
Slate's codebase is monorepo managed with Lerna. It consists of a handful of packages—although you won't always use all of them. They are:
Package | Version | Size | Description |
---|---|---|---|
slate | Slate's core data model logic. | ||
slate-history | A plugin that adds undo/redo history to Slate. | ||
slate-hyperscript | A hyperscript tool to write JSX Slate documents! | ||
slate-react | React components for rendering Slate editors. |
All contributions are super welcome! Check out the Contributing instructions for more info!
Slate is MIT-licensed.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
29 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
Found 22/23 approved changesets -- score normalized to 9
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
21 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More