loro-crdt 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ce16b52: feat: add sliceDelta method to slice a span of richtext #862
8
+
9
+ Use `text.sliceDelta(start, end)` when you need a Quill-style delta for only part of a rich text field (for example, to copy a styled snippet). The method takes UTF-16 indices; use `sliceDeltaUtf8` if you want to slice by UTF-8 byte offsets instead.
10
+
11
+ ```ts
12
+ import { LoroDoc } from "loro-crdt";
13
+
14
+ const doc = new LoroDoc();
15
+ doc.configTextStyle({
16
+ bold: { expand: "after" },
17
+ comment: { expand: "none" },
18
+ });
19
+ const text = doc.getText("text");
20
+
21
+ text.insert(0, "Hello World!");
22
+ text.mark({ start: 0, end: 5 }, "bold", true);
23
+ text.mark({ start: 6, end: 11 }, "comment", "greeting");
24
+
25
+ const snippet = text.sliceDelta(1, 8);
26
+ console.log(snippet);
27
+ // [
28
+ // { insert: "ello", attributes: { bold: true } },
29
+ // { insert: " " },
30
+ // { insert: "Wo", attributes: { comment: "greeting" } },
31
+ // ]
32
+ ```
33
+
34
+ ### Patch Changes
35
+
36
+ - a78d70f: fix: avoid convert panic #858
37
+ - ee94ee4: fix: EphemeralStore apply should ignore timeout entries #865
38
+ - 9e0a613: fix: Reject symbol-keyed map objects in wasm conversion #855
39
+
3
40
  ## 1.9.0
4
41
 
5
42
  ### Minor Changes