Gathering detailed insights and metrics for rich-text
Gathering detailed insights and metrics for rich-text
npm install rich-text
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
1,363,723
Last Day
886
Last Week
12,339
Last Month
51,918
Last Year
249,382
316 Stars
149 Commits
42 Forks
28 Watching
1 Branches
7 Contributors
Minified
Minified + Gzipped
Latest Version
4.1.0
Package Id
rich-text@4.1.0
Size
5.41 kB
NPM Version
6.14.4
Node Version
10.15.1
Publised On
03 Apr 2020
Cumulative downloads
Total Downloads
Last day
-48.7%
886
Compared to previous day
Last week
-9.8%
12,339
Compared to previous week
Last month
161.6%
51,918
Compared to previous month
Last year
42.9%
249,382
Compared to previous year
1
An OT Type for rich text documents.
For documentation on the spec this type implements, see ottypes/docs. Rich Text does not implement the optional invert
, but does implement normalize
, tranformCursor, serialize
, and deserialize
. Please refer to ottypes/docs for documentation.
Rich Text uses quill-delta on the back end.
Operations are an Array of changes, each operation describing a singular change to a document. They can be an insert
, delete
or retain
. Note operations do not take an index. They always describe the change at the current index. Use retains to "keep" or "skip" certain parts of the document.
Insert operations have an insert
key defined. A String value represents inserting text. Any other type represents inserting an embed (however only one level of object comparison will be performed for equality).
In both cases of text and embeds, an optional attributes
key can be defined with an Object to describe additonal formatting information. Formats can be changed by the retain operation.
1// Insert a bolded "Text" 2{ insert: "Text", attributes: { bold: true } } 3 4// Insert a link 5{ insert: "Google", attributes: { href: 'https://www.google.com' } } 6 7// Insert an embed 8{ 9 insert: { image: 'https://octodex.github.com/images/labtocat.png' }, 10 attributes: { alt: "Lab Octocat" } 11} 12 13// Insert another embed 14{ 15 insert: { video: 'https://www.youtube.com/watch?v=dMH0bHeiRNg' }, 16 attributes: { 17 width: 420, 18 height: 315 19 } 20}
Delete operations have a Number delete
key defined representing the number of characters to delete. All embeds have a length of 1.
1// Delete the next 10 characters 2{ delete: 10 }
Retain operations have a Number retain
key defined representing the number of characters to keep (other libraries might use the name keep or skip). An optional attributes
key can be defined with an Object to describe formatting changes to the character range. A value of null
in the attributes
Object represents removal of that key.
Note: It is not necessary to retain the last characters of a document as this is implied.
1// Keep the next 5 characters 2{ retain: 5 } 3 4// Keep and bold the next 5 characters 5{ retain: 5, attributes: { bold: true } } 6 7// Keep and unbold the next 5 characters 8// More specifically, remove the bold key in the attributes Object 9// in the next 5 characters 10{ retain: 5, attributes: { bold: null } }
This library was originally implemented as part of a full fledged Google Docs like product called Stypi. Eventually, parts were open sourced--the editor became Quill, the realtime engine became tandem and the document type became tandem-core.
ShareJS was a more established open source realtime collaboration engine, so tandem
and tandem-core
were deprecated to unify support under one project. tandem-core
was rewritten as rich-text
, to adhere to ShareJS's OT Type specification.
The needs of a realtime rich text document type was formerly a superset of a generalized rich text document type. As Quill has evolved, the reverse is becoming true. This rich-text
library today provides the interface to use with ShareJS, but the underlying type and fuctionality is implemented in quill-delta
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
15 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
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