@cocreate/text 1.12.18 → 1.12.22

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.12.22](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.21...v1.12.22) (2021-11-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * isSave for textarea and inputs... remove value before texts sets value on intialization ([e8fb19b](https://github.com/CoCreate-app/CoCreate-text/commit/e8fb19bc370769f2bffd937fb92b2e0ace886508))
7
+
8
+ ## [1.12.21](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.20...v1.12.21) (2021-11-20)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * updated script tags and link tags ([41f079d](https://github.com/CoCreate-app/CoCreate-text/commit/41f079df5ff8262f032c665a38c9e7682f54385b))
14
+
15
+ ## [1.12.20](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.19...v1.12.20) (2021-11-20)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * update dependencies ([733fdd6](https://github.com/CoCreate-app/CoCreate-text/commit/733fdd6591ed570b829b85fe319f32ae779e85f8))
21
+
22
+ ## [1.12.19](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.18...v1.12.19) (2021-11-18)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update dependencies ([1ff9e1c](https://github.com/CoCreate-app/CoCreate-text/commit/1ff9e1c5fe2e28393015c59c1c71a8e5fe445da0))
28
+
1
29
  ## [1.12.18](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.17...v1.12.18) (2021-11-17)
2
30
 
3
31
 
package/docs/index.html CHANGED
@@ -9,22 +9,8 @@
9
9
  <meta name="description" content="A simple HTML5 and pure javascript component. Easy configuration using HTML5 attributes or Javscript api and highly styleable." />
10
10
  <meta name="keywords" content="helper classes, utility classes, css framework, css library, inline style classes" />
11
11
  <meta name="robots" content="index,follow" />
12
-
13
- <!-- CoCreate CSS -->
14
- <link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
15
-
16
- <!-- Font Awesome -->
17
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" crossorigin="anonymous" />
18
-
19
- <!-- Codemirror -->
20
- <link rel="stylesheet" href="https://server.cocreate.app/CoCreate-plugins/CoCreate-codemirror/src/CoCreate-codemirror.css" type="text/css" />
21
- <link rel=stylesheet href="https://codemirror.net/lib/codemirror.css" async defer>
22
-
23
- <!-- Highlight.js-->
24
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/styles/default.min.css">
25
-
26
- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/highlight.min.js"></script>
27
- <script>hljs.initHighlightingOnLoad();</script>
12
+ <meta property="og:image" content="https://cdn.cocreate.app/docs/boilerplate.png">
13
+ <link rel="stylesheet" href="/docs/index.css" collection="files" document_id="60888216117c640e7596303f" name="src" type="text/css" save="true"/>
28
14
  </head>
29
15
 
30
16
  <body>
@@ -127,19 +113,8 @@
127
113
 
128
114
  </div>
129
115
  </div>
130
- <script>
131
- var config = {
132
- apiKey: 'c2b08663-06e3-440c-ef6f-13978b42883a',
133
- securityKey: 'f26baf68-e3a9-45fc-effe-502e47116265',
134
- organization_Id: '5de0387b12e200ea63204d6c'
135
- }
136
- </script>
137
-
138
- <!--CoCreateJS-->
139
- <script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
140
-
141
- <!-- CoCreate CodeMiirror -->
142
- <script type="text/javascript" src="https://server.cocreate.app/CoCreate-plugins/CoCreate-codemirror/dist/CoCreate-codemirror.js" async></script>
143
116
 
117
+ <script src="/apikey.js"></script>
118
+ <script src="https://cdn.cocreate.app/latest/CoCreate.min.js" ></script>
144
119
  </body>
145
120
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/text",
3
- "version": "1.12.18",
3
+ "version": "1.12.22",
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",
@@ -61,13 +61,13 @@
61
61
  "webpack-log": "^3.0.1"
62
62
  },
63
63
  "dependencies": {
64
- "@cocreate/action": "^1.3.12",
65
- "@cocreate/crdt": "^1.8.14",
66
- "@cocreate/crud-client": "^1.4.25",
67
- "@cocreate/cursors": "^1.10.7",
68
- "@cocreate/docs": "^1.2.50",
69
- "@cocreate/hosting": "^1.2.45",
70
- "@cocreate/observer": "^1.3.42",
71
- "@cocreate/selection": "^1.2.6"
64
+ "@cocreate/action": "^1.3.15",
65
+ "@cocreate/crdt": "^1.8.17",
66
+ "@cocreate/crud-client": "^1.4.29",
67
+ "@cocreate/cursors": "^1.10.9",
68
+ "@cocreate/docs": "^1.2.53",
69
+ "@cocreate/hosting": "^1.2.48",
70
+ "@cocreate/observer": "^1.3.45",
71
+ "@cocreate/selection": "^1.2.9"
72
72
  }
73
73
  }
package/src/index.js CHANGED
@@ -51,7 +51,13 @@ function initElement (element) {
51
51
  if (value)
52
52
  crdt.replaceText({ collection, document_id, name, value, crud: isCrud, save: isSave, read: isRead });
53
53
  }
54
- else
54
+ else
55
+ if (element.hasAttribute('contenteditable')){
56
+ element.innerHTML = '';
57
+ }
58
+ else {
59
+ element.value = '';
60
+ }
55
61
  updateElement({ element, collection, document_id, name, value: response, start: 0 })
56
62
  });
57
63
  }
@@ -180,7 +186,7 @@ function updateText ({element, value, start, end, range}) {
180
186
  if(isCrdt == "false") return;
181
187
  let length = end - start;
182
188
  if (element.tagName === "INPUT" || element.tagName === "TEXTAREA") {
183
- crdt.updateText({ collection, document_id, name, value, start, length, crud: isCrud });
189
+ crdt.updateText({ collection, document_id, name, value, start, length, crud: isCrud, save: isSave });
184
190
  } else {
185
191
  let startEl = range.startContainer.parentElement;
186
192
  let endEl = range.endContainer.parentElement;
@@ -209,8 +215,8 @@ function updateElements({elements, collection, document_id, name, value, start,
209
215
  let isCrdt = element.getAttribute('crdt');
210
216
  // if(isCrdt == 'false' && !element.hasAttribute('crdt') && !element.contentEditable) return;
211
217
  // if(element.hasAttribute('contenteditable')){
212
- let isEditable = element.getAttribute('contenteditable');
213
- if (!element.hasAttribute('contenteditable') && isCrdt == 'false') return;
218
+ // let isEditable = element.getAttribute('contenteditable');
219
+ if (!element.hasAttribute('contenteditable') && isCrdt == 'false') return;
214
220
 
215
221
  updateElement({element, collection, document_id, name, value, start, length});
216
222
  });