Skip to content

Commit

Permalink
fix: update packages, add uuid, add data-parse to demos
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Jun 6, 2021
1 parent 54c1a32 commit f3ecaa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 32 deletions.
20 changes: 3 additions & 17 deletions src/CoCreate-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function CoCreateModal(el, options, container) {
minHeight: 40,
};

this.id = CoCreateWindow.generateUUID(20);
this.id = CoCreate.uuid.generate(20);
this.el = el;
this.clicked = null;
this.redraw = false;
Expand Down Expand Up @@ -153,7 +153,7 @@ CoCreateModal.prototype = {
iframe.setAttribute('data-pass_id', attributes['data-pass_to']);
iframe.setAttribute('data-collection', "");
iframe.setAttribute('data-document_id', "");
iframe.setAttribute('data-request_id', CoCreateWindow.generateUUID(20));
iframe.setAttribute('data-request_id', CoCreate.uuid.generate(20));
}
if (attributes['data-pass_name']) {
iframe.setAttribute('name', attributes['data-pass_name']);
Expand Down Expand Up @@ -944,7 +944,7 @@ function CoCreateWindow(id) {
this.container = null;
this.id = container_id;

this.pageId = CoCreateWindow.generateUUID(20);
this.pageId = CoCreate.uuid.generate(20);
this.isRoot = this._checkRoot();


Expand Down Expand Up @@ -1148,20 +1148,6 @@ CoCreateWindow.prototype = {
},
}

CoCreateWindow.generateUUID = function(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}

var d = new Date().toTimeString();
var random = d.replace(/[\W_]+/g, "").substr(0,6);
result += random;
return result;
}

var CoCreateStorage = {};

Object.defineProperty(CoCreateStorage, "rootPageId", {
Expand Down
16 changes: 1 addition & 15 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
function generateUUID(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}

var d = new Date().toTimeString();
var random = d.replace(/[\W_]+/g, "").substr(0,6);
result += random;
return result;
}

var ModalStorage = {};

Object.defineProperty(ModalStorage, "rootPageId", {
Expand All @@ -30,4 +16,4 @@ Object.defineProperty(ModalStorage, "pageId", {
})


export {generateUUID, ModalStorage};
export {ModalStorage};

0 comments on commit f3ecaa0

Please sign in to comment.