@yorkie-js/react 0.6.42 → 0.6.44
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.
|
@@ -6300,9 +6300,10 @@ class SplayTree {
|
|
|
6300
6300
|
return this.root ? this.root.getWeight() : 0;
|
|
6301
6301
|
}
|
|
6302
6302
|
/**
|
|
6303
|
-
* `
|
|
6303
|
+
* `findForText` returns the Node and offset of the given position (cursor).
|
|
6304
|
+
* Used for Text where cursor placed between characters.
|
|
6304
6305
|
*/
|
|
6305
|
-
|
|
6306
|
+
findForText(pos) {
|
|
6306
6307
|
if (!this.root || pos < 0) {
|
|
6307
6308
|
return [void 0, 0];
|
|
6308
6309
|
}
|
|
@@ -6327,6 +6328,34 @@ class SplayTree {
|
|
|
6327
6328
|
this.splayNode(node);
|
|
6328
6329
|
return [node, pos];
|
|
6329
6330
|
}
|
|
6331
|
+
/**
|
|
6332
|
+
* `findForArray` returns the Node of the given position (index).
|
|
6333
|
+
* Used for Array where index points to the element.
|
|
6334
|
+
*/
|
|
6335
|
+
findForArray(idx) {
|
|
6336
|
+
if (!this.root) {
|
|
6337
|
+
return void 0;
|
|
6338
|
+
}
|
|
6339
|
+
if (idx < 0 || idx >= this.length) {
|
|
6340
|
+
throw new YorkieError(
|
|
6341
|
+
Code.ErrInvalidArgument,
|
|
6342
|
+
`out of index range: idx: ${idx}, length: ${this.length}`
|
|
6343
|
+
);
|
|
6344
|
+
}
|
|
6345
|
+
let node = this.root;
|
|
6346
|
+
for (; ; ) {
|
|
6347
|
+
if (node.hasLeft() && idx < node.getLeftWeight()) {
|
|
6348
|
+
node = node.getLeft();
|
|
6349
|
+
} else if (node.hasRight() && node.getLeftWeight() + node.getLength() <= idx) {
|
|
6350
|
+
idx -= node.getLeftWeight() + node.getLength();
|
|
6351
|
+
node = node.getRight();
|
|
6352
|
+
} else {
|
|
6353
|
+
break;
|
|
6354
|
+
}
|
|
6355
|
+
}
|
|
6356
|
+
this.splayNode(node);
|
|
6357
|
+
return node;
|
|
6358
|
+
}
|
|
6330
6359
|
/**
|
|
6331
6360
|
* Find the index of the given node in BST.
|
|
6332
6361
|
*
|
|
@@ -8009,15 +8038,8 @@ class RGATreeList {
|
|
|
8009
8038
|
if (idx >= this.length) {
|
|
8010
8039
|
return;
|
|
8011
8040
|
}
|
|
8012
|
-
const
|
|
8013
|
-
|
|
8014
|
-
if (idx === 0 && node === this.dummyHead || offset > 0) {
|
|
8015
|
-
do {
|
|
8016
|
-
if (rgaNode) {
|
|
8017
|
-
rgaNode = rgaNode.getNext();
|
|
8018
|
-
}
|
|
8019
|
-
} while (rgaNode && rgaNode.isRemoved());
|
|
8020
|
-
}
|
|
8041
|
+
const node = this.nodeMapByIndex.findForArray(idx);
|
|
8042
|
+
const rgaNode = node;
|
|
8021
8043
|
return rgaNode;
|
|
8022
8044
|
}
|
|
8023
8045
|
/**
|
|
@@ -9484,7 +9506,7 @@ class RGATreeSplit {
|
|
|
9484
9506
|
* `indexToPos` finds RGATreeSplitPos of given offset.
|
|
9485
9507
|
*/
|
|
9486
9508
|
indexToPos(idx) {
|
|
9487
|
-
const [node, offset] = this.treeByIndex.
|
|
9509
|
+
const [node, offset] = this.treeByIndex.findForText(idx);
|
|
9488
9510
|
const splitNode = node;
|
|
9489
9511
|
return RGATreeSplitPos.of(splitNode.getID(), offset);
|
|
9490
9512
|
}
|
|
@@ -19244,7 +19266,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
19244
19266
|
};
|
|
19245
19267
|
}
|
|
19246
19268
|
const name$1 = "@yorkie-js/sdk";
|
|
19247
|
-
const version$1 = "0.6.
|
|
19269
|
+
const version$1 = "0.6.44";
|
|
19248
19270
|
const pkg$1 = {
|
|
19249
19271
|
name: name$1,
|
|
19250
19272
|
version: version$1
|
|
@@ -19777,8 +19799,7 @@ class Client {
|
|
|
19777
19799
|
{
|
|
19778
19800
|
clientId: this.id,
|
|
19779
19801
|
documentId: attachment.resourceID,
|
|
19780
|
-
changePack: converter.toChangePack(doc.createChangePack())
|
|
19781
|
-
removeIfNotAttached: opts.removeIfNotAttached ?? false
|
|
19802
|
+
changePack: converter.toChangePack(doc.createChangePack())
|
|
19782
19803
|
},
|
|
19783
19804
|
{ headers: { "x-shard-key": `${this.apiKey}/${doc.getKey()}` } }
|
|
19784
19805
|
);
|
|
@@ -21031,7 +21052,7 @@ if (typeof globalThis !== "undefined") {
|
|
|
21031
21052
|
};
|
|
21032
21053
|
}
|
|
21033
21054
|
const name = "@yorkie-js/react";
|
|
21034
|
-
const version = "0.6.
|
|
21055
|
+
const version = "0.6.44";
|
|
21035
21056
|
const pkg = {
|
|
21036
21057
|
name,
|
|
21037
21058
|
version
|