@cocreate/crdt 1.14.16 → 1.14.18

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,3 +1,17 @@
1
+ ## [1.14.18](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.14.17...v1.14.18) (2022-12-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * replaceText will overwirte current changeLog ([5a426a4](https://github.com/CoCreate-app/CoCreate-crdt/commit/5a426a4ac7291b70761edb5ed7f892832752234d))
7
+
8
+ ## [1.14.17](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.14.16...v1.14.17) (2022-12-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump dependencies ([43397a7](https://github.com/CoCreate-app/CoCreate-crdt/commit/43397a7378ddce5a8479da6ebd5b3747110ed6d5))
14
+
1
15
  ## [1.14.16](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.14.15...v1.14.16) (2022-12-07)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/crdt",
3
- "version": "1.14.16",
3
+ "version": "1.14.18",
4
4
  "description": "CoCreate crdt",
5
5
  "author": "CoCreate LLC",
6
6
  "license": "SEE LICENSE",
@@ -43,8 +43,8 @@
43
43
  "webpack-log": "^3.0.1"
44
44
  },
45
45
  "dependencies": {
46
- "@cocreate/crud-client": "^1.16.1",
47
- "@cocreate/message-client": "^1.1.103",
48
- "@cocreate/utils": "^1.14.2"
46
+ "@cocreate/crud-client": "^1.16.3",
47
+ "@cocreate/message-client": "^1.1.104",
48
+ "@cocreate/utils": "^1.15.0"
49
49
  }
50
50
  }
package/src/index.js CHANGED
@@ -150,6 +150,7 @@ function insertChange(data, flag) {
150
150
  let lastChange = changeLog[changeLog.length - 1];
151
151
  if (lastChange && change.datetime && lastChange.datetime){
152
152
  if (change.datetime < lastChange.datetime){
153
+ // ToDo: insert change at index position and update start and end postions for every element after insert
153
154
  console.log('requires changeLog rebuild');
154
155
  }
155
156
  if (flag != 'replace') {
@@ -178,7 +179,14 @@ function insertChange(data, flag) {
178
179
  if (change.length > 0)
179
180
  change.removedValue = string.substr(change.start, change.length);
180
181
 
181
- changeLog.push(change);
182
+ if (flag == 'replace') {
183
+ // ToDo get current string and create new changeLog array then push new change
184
+ changeLog = [change];
185
+ name.set('changeLog', changeLog)
186
+ } else {
187
+ changeLog.push(change);
188
+ }
189
+
182
190
  name.set('text', string.customSplice(change.start, change.length, change.value));
183
191
  string = {string: name.get('text')};
184
192