Fixed issue with lists and id and for attributes not getting reindexed

This commit is contained in:
Djamil Legato
2016-03-08 17:26:06 -08:00
parent a3252ab4ec
commit 13b8f26720
2 changed files with 7 additions and 3 deletions

View File

@@ -69,6 +69,7 @@ export default class CollectionsField {
item.find('[' + prop + ']').each(function() {
let element = $(this);
let indexes = [];
element.parents('[data-collection-key]').map((idx, parent) => indexes.push($(parent).attr('data-collection-key')));
indexes.reverse();
@@ -76,10 +77,13 @@ export default class CollectionsField {
return `[${indexes.shift()}]`;
});
replaced = element.attr(prop).replace(/\.(\d+|\*)\./g, (/* str, p1, offset */) => {
return `.${indexes.shift()}.`;
});
element.attr(prop, replaced);
});
});
});
}

File diff suppressed because one or more lines are too long