Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITES-13898 - [AEMaaCS] The Accordion/Carousel/Tabs Component cannot delete dialog item after moving #2547

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ With AEM as a Cloud Service SDK, use the `cloud` profile as follows to deploy th

Note that:
* `-pl/-projects` option specifies the list of projects that you want to install
* `-am/-also-make` options specifies that dependencies should also be built
* `-am/-also-make` option specifies the dependencies that should also be built

For detailed informations see [BUILDING.md](BUILDING.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,25 +252,23 @@
}

Coral.commons.ready(that._elements.self, function(item) {
// As a reordering of the multifield also triggers the coral-collection:remove event we have to add
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since that._elements.self is referenced multiple times, could probably be stored as a const and used in all the other places, but this is more a nitpick

// a check for moved items so the prompt get only shown on a real remove action.
var movedItem;

that._elements.self.on("coral-multifield:itemorder", function(event) {
movedItem = event.detail.item.dataset["name"];
});
myronenko marked this conversation as resolved.
Show resolved Hide resolved

// coral-collection:remove event is triggered either when the element is removed
// or when the element is moved/reordered (in that case we'll temporarily remove it
// and it will be added back by the subsequent coral-collection:add event)
that._elements.self.on("coral-collection:remove", function(event) {
var name = event.detail.item.dataset["name"];
if (movedItem !== name) {
that._deletedChildren.push(name);
}
let elementToDelete = event.detail.item.dataset["name"];
myronenko marked this conversation as resolved.
Show resolved Hide resolved
that._deletedChildren.push(elementToDelete);
});

// coral-collection:add event is triggered either when the new element is added
// or when the element is moved/reordered (in that case we'll add back the temporarily
// removed element, hence we have to remove that element from the deleted list)
that._elements.self.on("coral-collection:add", function(event) {
if (movedItem !== event.detail.item.dataset["name"]) {
movedItem = undefined;
}
let elementToAdd = event.detail.item.dataset["name"];
myronenko marked this conversation as resolved.
Show resolved Hide resolved
that._deletedChildren = that._deletedChildren.filter(elementToDelete => elementToDelete !== elementToAdd);
});
});
},
Expand Down
Loading