const text = new RichText(BigInt(2));
text.insert(0, "123");
text.annotate(0, 1, "bold", AnnotateType.BoldLike);
text.insert(1, "k");
{
const spans = text.getAnnSpans();
expect(spans[0].text).toBe("1k");
expect(spans[0].annotations).toStrictEqual(new Set(["bold"]));
}
text.eraseAnn(0, 2, "bold", AnnotateType.BoldLike);
{
const spans = text.getAnnSpans();
expect(spans[0].text).toBe("1k23");
expect(spans[0].annotations.size).toBe(0);
}
crdt-richtext-wasm
0.4.0 • Public • Published/crdt-richtext-wasm/
Package Sidebar
Install
npm i crdt-richtext-wasm
Weekly Downloads
0
Version
0.4.0
License
ISC
Unpacked Size
1.33 MB
Total Files
14