Skip to content

Commit

Permalink
feat: support for multiple sources
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Mar 2, 2021
1 parent faa5293 commit b5052c0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test_files/CoCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function initDeleteTags() {
documentId = this.getAttribute('data-document_id');

if (document) {
CoCreate.deleteDocument({
CoCreate.crud.deleteDocument({
'collection': collection,
'document_id': documentId,
'metadata': ''
Expand Down Expand Up @@ -483,8 +483,8 @@ const CoCreate = {
if (!id) return;
if (CoCreateCrdt.getType(id)) {
let oldData = CoCreateCrdt.getType(id).toString();
CoCreateCrdt.deleteData(id, 0, Math.max(oldData.length, info.value.length));
CoCreateCrdt.insertData(id, 0, info.value);
CoCreatecrdt.deleteText(id, 0, Math.max(oldData.length, info.value.length));
CoCreatecrdt.insertText(id, 0, info.value);
} else {
this.updateDocument({
collection: info.collection,
Expand Down Expand Up @@ -539,7 +539,7 @@ const CoCreate = {


/*
CoCreate.insertDataCrdt({
CoCreate.crdt.insertText({
collection: 'module_activities',
document_id: '5e4802ce3ed96d38e71fc7e5',
name: 'name',
Expand All @@ -553,7 +553,7 @@ const CoCreate = {
this.validateKeysJson(info,['collection','document_id','name','value','position']);
let id = this.__getYDocId(info['collection'], info['document_id'], info['name'])
if (id) {
CoCreateCrdt.insertData(id, info['position'], info['value'], info['attributes']);
CoCreatecrdt.insertText(id, info['position'], info['value'], info['attributes']);
}
}
catch (e) {
Expand All @@ -563,7 +563,7 @@ const CoCreate = {


/*
CoCreate.deleteDataCrdt({
CoCreate.crdt.deleteText({
collection: 'module_activities',
document_id: '5e4802ce3ed96d38e71fc7e5',
name: 'name',
Expand All @@ -576,7 +576,7 @@ const CoCreate = {
this.validateKeysJson(info,['collection','document_id','name', 'position','length']);
let id = this.__getYDocId(info['collection'], info['document_id'], info['name'])
if (id) {
CoCreateCrdt.deleteData(id, info['position'], info['length']);
CoCreatecrdt.deleteText(id, info['position'], info['length']);
}
}
catch (e) {
Expand All @@ -586,7 +586,7 @@ const CoCreate = {


/*
CoCreate.getDataCrdt({
CoCreate.crdt.getText({
collection: 'module_activities',
document_id: '5e4802ce3ed96d38e71fc7e5',
name: 'name'
Expand Down

0 comments on commit b5052c0

Please sign in to comment.