@liveblocks/core 3.21.0-exp3 → 3.21.0-exp4

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/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "3.21.0-exp3";
9
+ var PKG_VERSION = "3.21.0-exp4";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -9814,19 +9814,31 @@ var LiveText = class _LiveText extends AbstractCrdt {
9814
9814
  return segmentsToData(this.#segments);
9815
9815
  }
9816
9816
  /** @internal */
9817
+ toTreeNode(key) {
9818
+ return super.toTreeNode(key);
9819
+ }
9820
+ /** @internal */
9817
9821
  _toTreeNode(key) {
9822
+ const nodeId = _nullishCoalesce(this._id, () => ( nanoid()));
9823
+ const payload = this.toJSON().map(
9824
+ (segment, index) => ({
9825
+ type: "Json",
9826
+ id: `${nodeId}:${index}`,
9827
+ key: String(index),
9828
+ payload: segment
9829
+ })
9830
+ );
9831
+ payload.push({
9832
+ type: "Json",
9833
+ id: `${nodeId}:version`,
9834
+ key: "version",
9835
+ payload: this.version
9836
+ });
9818
9837
  return {
9819
9838
  type: "LiveText",
9820
- id: _nullishCoalesce(this._id, () => ( nanoid())),
9839
+ id: nodeId,
9821
9840
  key,
9822
- payload: [
9823
- {
9824
- type: "Json",
9825
- id: `${_nullishCoalesce(this._id, () => ( nanoid()))}:text`,
9826
- key: "text",
9827
- payload: this.toString()
9828
- }
9829
- ]
9841
+ payload
9830
9842
  };
9831
9843
  }
9832
9844
  clone() {