Skip to content

Commit

Permalink
workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDoberer committed Sep 22, 2021
1 parent b32608e commit 95ab105
Show file tree
Hide file tree
Showing 3 changed files with 16,542 additions and 50 deletions.
55 changes: 36 additions & 19 deletions core/src/App.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,15 @@
const nodePath = Routing.getNodePath(currentNode, urlParamsRaw);

$: preservedViews.push({
path: config.iframe.luigi && config.iframe.luigi.pathParams
? GenericHelpers.replaceVars(nodePath, config.iframe.luigi.pathParams, ':', false)
: nodePath,
path:
config.iframe.luigi && config.iframe.luigi.pathParams
? GenericHelpers.replaceVars(
nodePath,
config.iframe.luigi.pathParams,
':',
false
)
: nodePath,
nextPath: nextPath.startsWith('/') ? nextPath : '/' + nextPath,
context
});
Expand Down Expand Up @@ -418,7 +424,7 @@
noAnimation = true;
setTimeout(() => {
const appNode = document.querySelector('#app');
if(appNode) {
if (appNode) {
appNode.classList.remove('no-animation');
}
});
Expand Down Expand Up @@ -1090,7 +1096,7 @@
if (hashRouting) {
nodepath = '#' + nodepath;
}

/*'noopener,noreferrer' required to disable XSS injections*/
window.open(nodepath, '_blank', 'noopener,noreferrer');
};
Expand Down Expand Up @@ -1144,6 +1150,18 @@

EventListenerHelpers.addEventListener('message', async e => {
const iframe = IframeHelpers.getValidMessageSource(e);
const specialIframeProps = {
modalIframe,
modalIframeData,
drawerIframe,
drawerIframeData,
drawer,
modal,
splitViewIframe,
splitViewIframeData,
splitView
};

if (!iframe) return;
iframe._ready = true;

Expand Down Expand Up @@ -1200,19 +1218,9 @@
iframe.luigi.clientVersion = e.data.clientVersion; // undefined for v0.x clients
iframe.luigi.initOk = false; // get-context indication. used for handshake verification

const specialIframeProps = {
modalIframe,
modalIframeData,
drawerIframe,
drawerIframeData,
drawer,
modal,
splitViewIframe,
splitViewIframeData,
splitView
};
const specialIframeMessageSource = IframeHelpers.specialIframeTypes.filter(typ =>
IframeHelpers.isMessageSource(e, specialIframeProps[typ.iframeKey])
let specialIframeMessageSource = IframeHelpers.getSpecialIframeMessageSource(
e,
specialIframeProps
);

if (specialIframeMessageSource.length > 0) {
Expand Down Expand Up @@ -1293,7 +1301,16 @@
path = GenericHelpers.addLeadingSlash(path);
openViewInNewTab(path);
} else if (e.data.params.modal !== undefined) {
let path = buildPath(e.data.params, srcNode, srcPathParams);
let path;
const specialIframeMessageSource = IframeHelpers.getSpecialIframeMessageSource(
e,
specialIframeProps
);
if (specialIframeMessageSource.length > 0) {
path = buildPath(e.data.params, srcNode, srcPathParams);
} else {
path = buildPath(e.data.params, undefined, undefined);
}
path = GenericHelpers.addLeadingSlash(path);
contentNode = node;
resetMicrofrontendModalData();
Expand Down
6 changes: 6 additions & 0 deletions core/src/utilities/helpers/iframe-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ class IframeHelpersClass {

return iframe;
}

getSpecialIframeMessageSource(e, specialIframeProps) {
return IframeHelpers.specialIframeTypes.filter(typ =>
IframeHelpers.isMessageSource(e, specialIframeProps[typ.iframeKey])
);
}
}

export const IframeHelpers = new IframeHelpersClass();
Loading

0 comments on commit 95ab105

Please sign in to comment.