0.4.0 • Published 12 months ago

crdt-richtext-wasm v0.4.0

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

crdt-richtext-wasm

Usage

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);
}
0.4.0

12 months ago

0.3.1

1 year ago

0.3.0

1 year ago