Skip to content

Commit e458cfc

Browse files
committed
fix: improved handling of data structure, added @cocreate/element-prototype
1 parent b416a9c commit e458cfc

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"@cocreate/actions": "^1.5.12",
6565
"@cocreate/api": "^1.4.12",
6666
"@cocreate/docs": "^1.3.18",
67+
"@cocreate/element-prototype": "^1.0.0",
6768
"@cocreate/utils": "^1.10.12"
6869
}
6970
}

src/index.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import action from '@cocreate/actions';
33
import observer from '@cocreate/observer';
44
import uuid from '@cocreate/uuid';
55
import { queryDocumentSelector } from '@cocreate/utils';
6+
import '@cocreate/element-prototype';
67
import './index.css';
7-
// import { getValue } from '../../CoCreate-elements/src/getValue';
88
// import api from '@cocreate/api';
99

1010
const CoCreateRender = {
@@ -70,11 +70,11 @@ const CoCreateRender = {
7070
variables.forEach((attr) => {
7171
let value;
7272

73-
if (attr == "{{data._id}}" || attr == `{{${renderKey}._id}}` || attr == "{{document_id}}")
74-
value = this.document_id;
75-
else if (attr == "{{collection}" || attr == `{{${renderKey}.collection}}`)
76-
value = this.collection;
77-
else
73+
// if (attr == "{{data._id}}" || attr == `{{${renderKey}._id}}` || attr == "{{document_id}}" || attr == "{{document._id}}")
74+
// value = this.document_id;
75+
// else if (attr == "{{collection}" || attr == `{{${renderKey}.collection}}`)
76+
// value = this.collection;
77+
// else
7878
value = self.__getValue(data, attr);
7979

8080
if (value) {
@@ -234,11 +234,11 @@ const CoCreateRender = {
234234
if (data.renderKey)
235235
isRenderKey = true
236236

237-
if (data.document._id)
238-
this.document_id = data.document._id;
237+
// if (data.document._id)
238+
// this.document_id = data.document._id;
239239

240-
if (data.collection)
241-
this.collection = data.collection;
240+
// if (data.collection)
241+
// this.collection = data.collection;
242242

243243
const that = this;
244244
Array.from(els).forEach(el => {

0 commit comments

Comments
 (0)