@cocreate/crdt 1.8.30 → 1.9.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,3 +1,10 @@
1
+ # [1.9.0](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.30...v1.9.0) (2022-01-31)
2
+
3
+
4
+ ### Features
5
+
6
+ * provide updated string to localChange update event ([83534dd](https://github.com/CoCreate-app/CoCreate-crdt/commit/83534dd74b868c4f1fdd35f1ae683e19cac33ec7))
7
+
1
8
  ## [1.8.30](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.29...v1.8.30) (2022-01-01)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/crdt",
3
- "version": "1.8.30",
3
+ "version": "1.9.0",
4
4
  "description": "CoCreate crdt",
5
5
  "author": "CoCreate LLC",
6
6
  "license": "SEE LICENSE",
package/src/index.js CHANGED
@@ -147,16 +147,17 @@ function insertChange(info, broadcast, flag) {
147
147
  changeLog.push(change);
148
148
  let string = name.get('text') || '';
149
149
  name.set('text', string.customSplice(change.start, change.length, change.value));
150
-
150
+ string = {string: name.get('text')};
151
+
151
152
  if(!info.clientId){
152
153
  info['datetime'] = change.datetime;
153
154
  info['clientId'] = change.clientId;
154
155
 
155
156
  broadcastChange(info);
156
- localChange(info);
157
+ localChange(info, string);
157
158
  }
158
159
  else
159
- localChange(info);
160
+ localChange(info, string);
160
161
 
161
162
  if (info.clientId == clientId && info.save != "false")
162
163
  persistChange(info);
@@ -181,9 +182,9 @@ function broadcastChange(info){
181
182
  });
182
183
  }
183
184
 
184
- function localChange(data) {
185
+ function localChange(data, string) {
185
186
  const localChange = new CustomEvent('cocreate-crdt-update', {
186
- detail: { ...data },
187
+ detail: { ...data, ...string },
187
188
  });
188
189
  window.dispatchEvent(localChange);
189
190
  }