Skip to content

Commit

Permalink
Merge pull request #13 from lordt/master
Browse files Browse the repository at this point in the history
More entropy to identifiers
  • Loading branch information
pkerspe authored Mar 18, 2019
2 parents cb9391c + 9bccc4a commit 8e9d9e9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugin.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CKEDITOR.plugins.add('collapsibleItem', {
var accordionid = "";
if(editor.elementPath() != null) {
var parents = editor.elementPath().elements;
for (i = 0; i < parents.length; i++) {
for (var i = 0; i < parents.length; i++) {
if (parents[i].hasClass('accordion-list-group')) {
accordionid = parents[i].getId();
break;
Expand All @@ -53,15 +53,19 @@ CKEDITOR.plugins.add('collapsibleItem', {
}
if(accordionid == ""){
var parents = this.element.getParents();
for(i = 0 ; i < parents.length ; i++){
for(var i = 0 ; i < parents.length ; i++){
if(parents[i].hasClass('accordion-list-group')){
accordionid = parents[i].getId();
break;
}
}
}
var uniqueIdentifier = [
(new Date()).getTime(),
('' + 1e6 * Math.random()).substring(0, 6)
].join('_');
this.setData('accordionId', accordionid);
this.setData('itemId', 'Collapsible' + (new Date()).getTime());
this.setData('itemId', 'Collapsible' + uniqueIdentifier);
},
data: function () {
//called whenever the data is updated
Expand Down

0 comments on commit 8e9d9e9

Please sign in to comment.