@cocreate/text 1.8.0 → 1.9.1

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.9.1](https://github.com/CoCreate-app/CoCreate-text/compare/v1.9.0...v1.9.1) (2021-10-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * cant resove [@cocreate-crud](https://github.com/cocreate-crud) ([e0ec1d1](https://github.com/CoCreate-app/CoCreate-text/commit/e0ec1d1d9f3a2a34e3c2e7a28ef6b0cdc9f86fbf))
7
+
8
+ # [1.9.0](https://github.com/CoCreate-app/CoCreate-text/compare/v1.8.2...v1.9.0) (2021-10-04)
9
+
10
+
11
+ ### Features
12
+
13
+ * action to save domText ([1315853](https://github.com/CoCreate-app/CoCreate-text/commit/1315853a9a44cb978b09484f1ecddc87967ae18d))
14
+
15
+ ## [1.8.2](https://github.com/CoCreate-app/CoCreate-text/compare/v1.8.1...v1.8.2) (2021-10-01)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * update packages ([1f67259](https://github.com/CoCreate-app/CoCreate-text/commit/1f67259bc2a65f58768d487812a6cff87eea1e6f))
21
+
22
+ ## [1.8.1](https://github.com/CoCreate-app/CoCreate-text/compare/v1.8.0...v1.8.1) (2021-10-01)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update dependencies ([6ffa726](https://github.com/CoCreate-app/CoCreate-text/commit/6ffa726a623ad3101d46c788257363c35cd2c086))
28
+
1
29
  # [1.8.0](https://github.com/CoCreate-app/CoCreate-text/compare/v1.7.3...v1.8.0) (2021-09-30)
2
30
 
3
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/text",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "A simple text component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "text",
@@ -61,10 +61,11 @@
61
61
  "webpack-log": "^3.0.1"
62
62
  },
63
63
  "dependencies": {
64
- "@cocreate/crdt": "^1.3.19",
65
- "@cocreate/crud-client": "^1.2.25",
66
- "@cocreate/docs": "^1.2.22",
67
- "@cocreate/hosting": "^1.2.19",
68
- "@cocreate/observer": "^1.3.20"
64
+ "@cocreate/action": "^1.2.23",
65
+ "@cocreate/crdt": "^1.3.21",
66
+ "@cocreate/crud-client": "^1.2.29",
67
+ "@cocreate/docs": "^1.2.26",
68
+ "@cocreate/hosting": "^1.2.22",
69
+ "@cocreate/observer": "^1.3.23"
69
70
  }
70
71
  }
package/src/index.js CHANGED
@@ -7,6 +7,7 @@ import {updateDom} from './updateDom';
7
7
  import {insertAdjacentElement, removeElement, setInnerText, setAttribute, removeAttribute, setClass, setStyle, setClassStyle, replaceInnerText} from './updateText';
8
8
  import {findElByPos} from './textPosition';
9
9
  import {getSelections, processSelections, hasSelection} from './selections';
10
+ import './saveDomText';
10
11
 
11
12
  let eventObj;
12
13
  let selector = `[collection][document_id][name]`;
@@ -0,0 +1,31 @@
1
+ /*globals CustomEvent*/
2
+ import action from '@cocreate/action';
3
+ import crud from '@cocreate/crud-client';
4
+ import crdt from '@cocreate/crdt';
5
+
6
+ function save(btn){
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
20
+ });
21
+
22
+ document.dispatchEvent(new CustomEvent('savedDomText'));
23
+ }
24
+
25
+ action.init({
26
+ action: "saveDomText",
27
+ endEvent: "savedDomText",
28
+ callback: (btn, data) => {
29
+ save(btn);
30
+ },
31
+ });
package/src/updateDom.js CHANGED
@@ -249,7 +249,8 @@ function elIndexOf(id, elList) {
249
249
 
250
250
  function renameTagName(newEl, domEl) {
251
251
  let newDomEl = document.createElement(newEl.tagName);
252
- assignAttributes(newEl, newDomEl, newDomEl);
252
+ newDomEl.attributes = newEl.attributes;
253
+ // assignAttributes(newEl, newDomEl, newDomEl);
253
254
  newDomEl.replaceChildren(...newEl.childNodes);
254
255
  domEl.replaceWith(newDomEl);
255
256
  }