Skip to content

Commit

Permalink
confirmation modal from special iframe mfes (SAP#2594)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardl authored Feb 25, 2022
1 parent 5eb3a38 commit a90983e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -832,19 +832,20 @@
resetConfirmationModalData();
export const showModal = (settings, openFromClient = false) => {
export const showModal = (settings, openFromClient = false, targetIframe) => {
return new Promise((resolve, reject) => {
confirmationModal = {
displayed: true,
settings,
openFromClient,
promise: { resolve, reject },
targetIframe,
};
});
};
const handleModalResult = (result) => {
const { promise, openFromClient } = confirmationModal;
const { promise, openFromClient, targetIframe } = confirmationModal;
resetConfirmationModalData();
Expand All @@ -854,13 +855,12 @@
promise.reject();
}
if (openFromClient) {
const iframe = Iframe.getActiveIframe(contentNode);
if (openFromClient && targetIframe) {
const message = {
msg: 'luigi.ux.confirmationModal.hide',
data: { confirmed: result },
};
IframeHelpers.sendMessageToIframe(iframe, message);
IframeHelpers.sendMessageToIframe(targetIframe, message);
}
};
Expand Down Expand Up @@ -1433,7 +1433,7 @@
const settings = e.data.data.settings;
contentNode = node;
resetConfirmationModalData();
showModal(settings, true).catch(() => {
showModal(settings, true, iframe).catch(() => {
/* keep it to avoid runtime errors in browser console */
});
}
Expand Down

0 comments on commit a90983e

Please sign in to comment.