Skip to content

Commit

Permalink
bug #5710 Fix new item insertion selector, see #5368 (quentint)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 4.x branch.

Discussion
----------

Fix new item insertion selector, see #5368

This selector fix allows collections' new items to be injected at their correct place in the DOM.

It does not take into account the `isArrayCollection` case as I do not know how to reproduce it.
Also, recompiling the admin assets might be necessary (this is a draft PR).

Commits
-------

ef50c04 Fix new item insertion selector, see #5368
  • Loading branch information
javiereguiluz committed Apr 24, 2023
2 parents be698e9 + ef50c04 commit 2cb5e2f
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 288 deletions.
2 changes: 1 addition & 1 deletion assets/js/field-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const EaCollectionProperty = {
.replace(nameRegexp, numItems);

collection.dataset.numItems = numItems;
const newItemInsertionSelector = isArrayCollection ? '.ea-form-collection-items' : '.ea-form-collection-items .accordion > .form-widget-compound';
const newItemInsertionSelector = isArrayCollection ? '.ea-form-collection-items' : '.ea-form-collection-items .accordion > .form-widget-compound [data-empty-collection]';
const collectionItemsWrapper = collection.querySelector(newItemInsertionSelector);

collectionItemsWrapper.insertAdjacentHTML('beforeend', newItemHtml);
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/public/app.a444d0a8.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Resources/public/app.a444d0a8.rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Resources/public/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"field-collection": {
"js": [
"/field-collection.c6a8940b.js"
"/field-collection.a88a5924.js"
]
},
"field-file-upload": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2cb5e2f

Please sign in to comment.