@cocreate/crdt 1.8.20 → 1.8.24
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 +29 -0
- package/docs/index.html +8 -2
- package/package.json +5 -5
- package/src/index.js +26 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [1.8.24](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.23...v1.8.24) (2021-11-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add nav and sidenav to docs ([4749696](https://github.com/CoCreate-app/CoCreate-crdt/commit/47496966a2faa8dd1b7b999a8592a09d56c8d516))
|
|
7
|
+
* updated action dependency to actions ([04c3728](https://github.com/CoCreate-app/CoCreate-crdt/commit/04c3728d8e5e575baecf70db57e8f9137a0fc95e))
|
|
8
|
+
|
|
9
|
+
## [1.8.23](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.22...v1.8.23) (2021-11-26)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* getDocs will request generateText with changeLog true or false ([2309736](https://github.com/CoCreate-app/CoCreate-crdt/commit/230973632f96a8a65f1bea430e626a8a7e6223af))
|
|
15
|
+
|
|
16
|
+
## [1.8.22](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.21...v1.8.22) (2021-11-23)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* update dependencies ([e4f1d13](https://github.com/CoCreate-app/CoCreate-crdt/commit/e4f1d136b47f11120a61ddaa91dd782cdd42ab5d))
|
|
22
|
+
|
|
23
|
+
## [1.8.21](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.20...v1.8.21) (2021-11-23)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* await generateText ([917dd9a](https://github.com/CoCreate-app/CoCreate-crdt/commit/917dd9acdeae8b6dc9185aa2049dd28b0337e3eb))
|
|
29
|
+
|
|
1
30
|
## [1.8.20](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.19...v1.8.20) (2021-11-22)
|
|
2
31
|
|
|
3
32
|
|
package/docs/index.html
CHANGED
|
@@ -17,7 +17,13 @@
|
|
|
17
17
|
</head>
|
|
18
18
|
|
|
19
19
|
<body>
|
|
20
|
-
|
|
20
|
+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" collection="files" document_id="60395ef42b3ac232657040fd" name="src">
|
|
21
|
+
</nav>
|
|
22
|
+
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-target="[content_id='content']" resize-property="margin-left" resize-value="width">
|
|
23
|
+
<menu collection="files" document_id="603717b07de7fb350ae9fec8" name="src"></menu>
|
|
24
|
+
<div resize="right"></div>
|
|
25
|
+
</sidenav>
|
|
26
|
+
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="cocreate-crdt">
|
|
21
27
|
<div class="display:flex flex-wrap:wrap justify-content:space-between margin:10px">
|
|
22
28
|
<div class="display:flex align-items:center">
|
|
23
29
|
<h2>CoCreate-crdt</h2>
|
|
@@ -112,7 +118,7 @@
|
|
|
112
118
|
</div>
|
|
113
119
|
|
|
114
120
|
</div>
|
|
115
|
-
</
|
|
121
|
+
</main>
|
|
116
122
|
|
|
117
123
|
<script src="/apikey.js"></script>
|
|
118
124
|
<script src="https://cdn.cocreate.app/latest/CoCreate.min.js" ></script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/crdt",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.24",
|
|
4
4
|
"description": "CoCreate crdt",
|
|
5
5
|
"author": "CoCreate LLC",
|
|
6
6
|
"license": "SEE LICENSE",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"webpack-log": "^3.0.1"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@cocreate/
|
|
47
|
-
"@cocreate/crud-client": "^1.4.
|
|
48
|
-
"@cocreate/message-client": "^1.1.
|
|
49
|
-
"@cocreate/utils": "^1.3.
|
|
46
|
+
"@cocreate/actions": "^1.3.18",
|
|
47
|
+
"@cocreate/crud-client": "^1.4.34",
|
|
48
|
+
"@cocreate/message-client": "^1.1.52",
|
|
49
|
+
"@cocreate/utils": "^1.3.12"
|
|
50
50
|
}
|
|
51
51
|
}
|
package/src/index.js
CHANGED
|
@@ -34,7 +34,6 @@ async function getDoc(info) {
|
|
|
34
34
|
|
|
35
35
|
if (!docs.get(docName).get(typeName).has('changeLog')) {
|
|
36
36
|
let changeLog = [];
|
|
37
|
-
docs.get(docName).get(typeName).set('changeLog', changeLog);
|
|
38
37
|
|
|
39
38
|
if (info.read != 'false') {
|
|
40
39
|
let response = await crud.readDocumentList({
|
|
@@ -49,10 +48,13 @@ async function getDoc(info) {
|
|
|
49
48
|
});
|
|
50
49
|
if (response.data.length && response.data[0][typeName]) {
|
|
51
50
|
changeLog = response.data[0][typeName];
|
|
52
|
-
docs.get(docName).get(typeName).set('changeLog', changeLog);
|
|
53
51
|
}
|
|
52
|
+
docs.get(docName).get(typeName).set('changeLog', changeLog);
|
|
53
|
+
await generateText(info, true);
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
}
|
|
56
|
+
else if (!docs.get(docName).get(typeName).has('text')){
|
|
57
|
+
await generateText(info, false);
|
|
56
58
|
}
|
|
57
59
|
return true;
|
|
58
60
|
}
|
|
@@ -65,7 +67,7 @@ String.prototype.customSplice = function (index, absIndex, string) {
|
|
|
65
67
|
return this.slice(0, index) + string+ this.slice(index + Math.abs(absIndex));
|
|
66
68
|
};
|
|
67
69
|
|
|
68
|
-
async function generateText(info) {
|
|
70
|
+
async function generateText(info, flag) {
|
|
69
71
|
try {
|
|
70
72
|
let name = docs.get(`${info.collection}${info.document_id}`).get(info.name);
|
|
71
73
|
let string = '';
|
|
@@ -73,26 +75,27 @@ async function generateText(info) {
|
|
|
73
75
|
for (let change of changeLog) {
|
|
74
76
|
string = string.customSplice(change.start, change.length, change.value);
|
|
75
77
|
}
|
|
78
|
+
if (string == '' && info.read != 'false'){
|
|
79
|
+
string = await checkDb(info, flag);
|
|
80
|
+
}
|
|
76
81
|
name.set('text', string);
|
|
77
|
-
|
|
78
|
-
checkDb(info);
|
|
82
|
+
return;
|
|
79
83
|
}
|
|
80
84
|
catch (e) {
|
|
81
85
|
console.error(e);
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
|
|
85
|
-
function checkDb(info) {
|
|
89
|
+
async function checkDb(info, flag) {
|
|
86
90
|
let { collection, document_id, name } = info;
|
|
87
|
-
crud.readDocument({ collection, document_id, name })
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
91
|
+
let response = await crud.readDocument({ collection, document_id, name })
|
|
92
|
+
let string = response.data[name];
|
|
93
|
+
if (string && flag != false) {
|
|
94
|
+
info.value = string;
|
|
95
|
+
info.start = 0;
|
|
96
|
+
insertChange(info);
|
|
97
|
+
}
|
|
98
|
+
return string || '';
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
function insertChange(info, broadcast, flag) {
|
|
@@ -228,7 +231,13 @@ async function getText(info) {
|
|
|
228
231
|
let typeName = info.name;
|
|
229
232
|
let doc = await getDoc(info);
|
|
230
233
|
if (doc) {
|
|
231
|
-
|
|
234
|
+
let value = docs.get(docName).get(typeName).get('text')
|
|
235
|
+
if (!value)
|
|
236
|
+
console.log(value)
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
console.log('undefined')
|
|
232
241
|
}
|
|
233
242
|
}
|
|
234
243
|
catch (e) {
|