@cocreate/text 1.14.5 → 1.14.9

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,31 @@
1
+ ## [1.14.9](https://github.com/CoCreate-app/CoCreate-text/compare/v1.14.8...v1.14.9) (2022-01-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * saveDomText.js updated to awiat value from crdt.getText ([1b7a433](https://github.com/CoCreate-app/CoCreate-text/commit/1b7a433acda72f4cf12ad283b6aa37b4367fbea5))
7
+
8
+ ## [1.14.8](https://github.com/CoCreate-app/CoCreate-text/compare/v1.14.7...v1.14.8) (2022-01-13)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * removed if case that resulted in value not inserting if oldValue and newValue where equal ([187167e](https://github.com/CoCreate-app/CoCreate-text/commit/187167e03fb1cfc5132848f443d32d4f2d3ffe8e))
14
+
15
+ ## [1.14.7](https://github.com/CoCreate-app/CoCreate-text/compare/v1.14.6...v1.14.7) (2022-01-11)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * addEvents if isCrdt != true ([b57f83b](https://github.com/CoCreate-app/CoCreate-text/commit/b57f83ba299f4a27802f48a14c2a252095cb91ba))
21
+
22
+ ## [1.14.6](https://github.com/CoCreate-app/CoCreate-text/compare/v1.14.5...v1.14.6) (2022-01-01)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * get-value attribute value now supports a selector added # to all values currently in get-value attributes ([260fcd3](https://github.com/CoCreate-app/CoCreate-text/commit/260fcd39de882d34c16887a84d6cc746f9095b02))
28
+
1
29
  ## [1.14.5](https://github.com/CoCreate-app/CoCreate-text/compare/v1.14.4...v1.14.5) (2022-01-01)
2
30
 
3
31
 
package/docs/index.html CHANGED
@@ -87,7 +87,7 @@
87
87
  <div class="svSplitter svHorizontal"> </div>
88
88
 
89
89
  <div class="svPanel">
90
- <iframe get-value="demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
90
+ <iframe get-value="#demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
91
91
  </div>
92
92
 
93
93
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/text",
3
- "version": "1.14.5",
3
+ "version": "1.14.9",
4
4
  "description": "A simple text component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "text",
package/src/index.js CHANGED
@@ -35,11 +35,12 @@ function initElement (element) {
35
35
 
36
36
  if (!isCrdt) {
37
37
  if (element.tagName == 'IFRAME'){
38
- _addEventListeners(element.contentDocument.documentElement);
38
+ if (isCrdt != 'true')
39
+ _addEventListeners(element.contentDocument.documentElement);
39
40
  let Document = element.contentDocument;
40
41
  initDocument(Document);
41
42
  }
42
- else{
43
+ else if (isCrdt != 'true'){
43
44
  _addEventListeners(element);
44
45
  }
45
46
  }
@@ -307,8 +308,7 @@ async function updateElement ({element, collection, document_id, name, value, st
307
308
  _updateElementText(element, "", start, start + length);
308
309
  }
309
310
  if(value) {
310
- if (element.value != value)
311
- _updateElementText(element, value, start, start);
311
+ _updateElementText(element, value, start, start);
312
312
  }
313
313
  }
314
314
  else {
@@ -5,21 +5,22 @@ import crdt from '@cocreate/crdt';
5
5
 
6
6
  function save(btn){
7
7
  const { collection, document_id, name, namespace, room, isBroadcast, isBroadcastSender, isUpsert} = crud.getAttr(btn);
8
- let data = crdt.getText({collection, document_id, name});
9
- crud.updateDocument({
10
- collection: collection,
11
- document_id: document_id,
12
- data: {
13
- [name]: data
14
- },
15
- upsert: isUpsert,
16
- namespace: namespace,
17
- room: room,
18
- broadcast: isBroadcast,
19
- broadcast_sender: isBroadcastSender
8
+ crdt.getText({collection, document_id, name}).then(response => {
9
+ crud.updateDocument({
10
+ collection: collection,
11
+ document_id: document_id,
12
+ data: {
13
+ [name]: response
14
+ },
15
+ upsert: isUpsert,
16
+ namespace: namespace,
17
+ room: room,
18
+ broadcast: isBroadcast,
19
+ broadcast_sender: isBroadcastSender
20
+ });
21
+
22
+ document.dispatchEvent(new CustomEvent('savedDomText'));
20
23
  });
21
-
22
- document.dispatchEvent(new CustomEvent('savedDomText'));
23
24
  }
24
25
 
25
26
  action.init({