Skip to content

Commit 8fa59fa

Browse files
committed
IBX-8316: Modal for taxonomy entry assignment field displaying not perfectly with page builder
1 parent d58d8ac commit 8fa59fa

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
1-
const controlZIndex = (container) => {
1+
const controlZIndex = (container, listenerContainer, resetedZIndex = 'initial') => {
22
const initialZIndex = container.style.zIndex;
3-
4-
container.addEventListener('show.bs.modal', () => {
5-
container.style.zIndex = 'initial';
6-
});
7-
container.addEventListener('hide.bs.modal', () => {
3+
const finalListenerContainer = listenerContainer ?? container;
4+
const handleShowModal = () => {
5+
container.style.zIndex = resetedZIndex;
6+
};
7+
const handleCloseModal = () => {
88
container.style.zIndex = initialZIndex;
9-
});
9+
};
10+
const removeControlZIndexListeners = () => {
11+
finalListenerContainer.removeEventListener('show.bs.modal', handleShowModal, false);
12+
finalListenerContainer.removeEventListener('hidden.bs.modal', handleCloseModal, false);
13+
14+
document.body.dispatchEvent(new CustomEvent('ibexa-control-z-index:events-detached'));
15+
};
16+
17+
finalListenerContainer.addEventListener('show.bs.modal', handleShowModal, false);
18+
finalListenerContainer.addEventListener('hidden.bs.modal', handleCloseModal, false);
1019

1120
document.body.dispatchEvent(new CustomEvent('ibexa-control-z-index:events-attached'));
21+
22+
return {
23+
removeControlZIndexListeners,
24+
};
25+
};
26+
27+
const controlZIndexBulk = (items) => {
28+
const storedControlZIndex = items.map((item) => {
29+
return controlZIndex(...item);
30+
});
31+
const removeControlZIndexListeners = () => {
32+
storedControlZIndex.forEach((item) => {
33+
item.removeControlZIndexListeners();
34+
});
35+
};
36+
37+
return {
38+
removeControlZIndexListeners,
39+
};
1240
};
1341

14-
export { controlZIndex };
42+
export { controlZIndex, controlZIndexBulk };

0 commit comments

Comments
 (0)