@cocreate/crdt 1.8.22 → 1.8.26
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 +32 -46
- package/package.json +5 -5
- package/src/index.js +22 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [1.8.26](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.25...v1.8.26) (2021-11-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update dependencies ([d25abfe](https://github.com/CoCreate-app/CoCreate-crdt/commit/d25abfef4ba63dd74bc889e043a9fa0b6a8cb973))
|
|
7
|
+
|
|
8
|
+
## [1.8.25](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.24...v1.8.25) (2021-11-27)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update docs api and cocreateJS script ([dc2bbcc](https://github.com/CoCreate-app/CoCreate-crdt/commit/dc2bbcca94828ef8d3699aec37f68a1b5eb7095b))
|
|
14
|
+
|
|
15
|
+
## [1.8.24](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.23...v1.8.24) (2021-11-26)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* add nav and sidenav to docs ([4749696](https://github.com/CoCreate-app/CoCreate-crdt/commit/47496966a2faa8dd1b7b999a8592a09d56c8d516))
|
|
21
|
+
* updated action dependency to actions ([04c3728](https://github.com/CoCreate-app/CoCreate-crdt/commit/04c3728d8e5e575baecf70db57e8f9137a0fc95e))
|
|
22
|
+
|
|
23
|
+
## [1.8.23](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.22...v1.8.23) (2021-11-26)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* getDocs will request generateText with changeLog true or false ([2309736](https://github.com/CoCreate-app/CoCreate-crdt/commit/230973632f96a8a65f1bea430e626a8a7e6223af))
|
|
29
|
+
|
|
1
30
|
## [1.8.22](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.8.21...v1.8.22) (2021-11-23)
|
|
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>
|
|
@@ -64,55 +70,35 @@
|
|
|
64
70
|
<!-- SandBox -->
|
|
65
71
|
<h2 class="border-bottom:1px_solid_lightgrey padding:5px_0px">Demo</h2>
|
|
66
72
|
<div class="position:sticky top:0 padding:10px_0px height:100vh">
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<div class="svPanel">
|
|
93
|
-
<div realtime="false"
|
|
94
|
-
collection="modules"
|
|
95
|
-
document_id="5eefe30952c6e94c75fb5e3f"
|
|
96
|
-
name="html"
|
|
97
|
-
id="7"
|
|
98
|
-
class="codemirror height:100% min-width:300px">
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
<div class="svSplitter svHorizontal"> </div>
|
|
102
|
-
|
|
103
|
-
<div class="svPanel">
|
|
104
|
-
<iframe get-value="7" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
<!-- End SandBox -->
|
|
73
|
+
<!-- SandBox -->
|
|
74
|
+
<div class="container svColumn overflow:hidden card position:relative border-radius:2px width:auto height:100%" id="sandbox">
|
|
75
|
+
<div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
|
76
|
+
<a class="margin-right:10px" id="code" show="#preview" hide="#code, #view"><i class="far fa-eye"></i></a>
|
|
77
|
+
<a class="margin-right:10px hidden" id="preview" show="#code, #view" hide="#preview"><i class="fas fa-code"></i></a>
|
|
78
|
+
<a class="margin-right:5px" fullscreen target="#playground"><i class="fas fa-expand"></i></a>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="svRow">
|
|
81
|
+
|
|
82
|
+
<div class="svColumn">
|
|
83
|
+
|
|
84
|
+
<div class="svPanel" id="view">
|
|
85
|
+
<textarea collection="demos" document_id="" name="demo" save="false" id="demo" class="height:100% width:100% border:none resize:none padding:5px"></textarea>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="svSplitter svHorizontal"> </div>
|
|
88
|
+
|
|
89
|
+
<div class="svPanel">
|
|
90
|
+
<iframe get-value="demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<!-- End SandBox -->
|
|
111
97
|
</div>
|
|
112
98
|
</div>
|
|
113
99
|
|
|
114
100
|
</div>
|
|
115
|
-
</
|
|
101
|
+
</main>
|
|
116
102
|
|
|
117
103
|
<script src="/apikey.js"></script>
|
|
118
104
|
<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.26",
|
|
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.22",
|
|
47
|
+
"@cocreate/crud-client": "^1.4.37",
|
|
48
|
+
"@cocreate/message-client": "^1.1.55",
|
|
49
|
+
"@cocreate/utils": "^1.3.15"
|
|
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,12 +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
|
-
if (!docs.get(docName).get(typeName).has('text')){
|
|
57
|
-
await generateText(info);
|
|
56
|
+
else if (!docs.get(docName).get(typeName).has('text')){
|
|
57
|
+
await generateText(info, false);
|
|
58
58
|
}
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
@@ -67,7 +67,7 @@ String.prototype.customSplice = function (index, absIndex, string) {
|
|
|
67
67
|
return this.slice(0, index) + string+ this.slice(index + Math.abs(absIndex));
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
async function generateText(info) {
|
|
70
|
+
async function generateText(info, flag) {
|
|
71
71
|
try {
|
|
72
72
|
let name = docs.get(`${info.collection}${info.document_id}`).get(info.name);
|
|
73
73
|
let string = '';
|
|
@@ -75,9 +75,10 @@ async function generateText(info) {
|
|
|
75
75
|
for (let change of changeLog) {
|
|
76
76
|
string = string.customSplice(change.start, change.length, change.value);
|
|
77
77
|
}
|
|
78
|
+
if (string == '' && info.read != 'false'){
|
|
79
|
+
string = await checkDb(info, flag);
|
|
80
|
+
}
|
|
78
81
|
name.set('text', string);
|
|
79
|
-
if (string == '' && info.read != 'false')
|
|
80
|
-
await checkDb(info);
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
84
|
catch (e) {
|
|
@@ -85,18 +86,16 @@ async function generateText(info) {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
function checkDb(info) {
|
|
89
|
+
async function checkDb(info, flag) {
|
|
89
90
|
let { collection, document_id, name } = info;
|
|
90
|
-
crud.readDocument({ collection, document_id, name })
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return;
|
|
99
|
-
});
|
|
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 || '';
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
function insertChange(info, broadcast, flag) {
|
|
@@ -233,8 +232,13 @@ async function getText(info) {
|
|
|
233
232
|
let doc = await getDoc(info);
|
|
234
233
|
if (doc) {
|
|
235
234
|
let value = docs.get(docName).get(typeName).get('text')
|
|
235
|
+
if (!value)
|
|
236
|
+
console.log(value)
|
|
236
237
|
return value;
|
|
237
238
|
}
|
|
239
|
+
else {
|
|
240
|
+
console.log('undefined')
|
|
241
|
+
}
|
|
238
242
|
}
|
|
239
243
|
catch (e) {
|
|
240
244
|
console.error(e);
|