Web: Scripts: Api: Fixed frames element inside sdk

This commit is contained in:
Ilya Oleshko 2023-05-11 14:09:53 +03:00
parent 794f55d8a4
commit 295d1b3105
2 changed files with 14 additions and 4 deletions

View File

@ -395,6 +395,7 @@ class PureHome extends React.Component {
refreshFiles, refreshFiles,
setViewAs, setViewAs,
hashSettings, hashSettings,
logout,
} = this.props; } = this.props;
const eventData = typeof e.data === "string" ? JSON.parse(e.data) : e.data; const eventData = typeof e.data === "string" ? JSON.parse(e.data) : e.data;
@ -488,6 +489,11 @@ class PureHome extends React.Component {
res = hashSettings; res = hashSettings;
break; break;
} }
case "logout":
{
res = logout();
}
break;
default: default:
res = "Wrong method"; res = "Wrong method";
} }
@ -664,8 +670,6 @@ export default inject(
setIsPreview, setIsPreview,
} = filesStore; } = filesStore;
const { hashSettings } = auth.settingsStore;
const { gallerySelected } = oformsStore; const { gallerySelected } = oformsStore;
const { const {
@ -716,6 +720,7 @@ export default inject(
frameConfig, frameConfig,
isFrame, isFrame,
withPaging, withPaging,
hashSettings,
} = auth.settingsStore; } = auth.settingsStore;
if (!firstLoad) { if (!firstLoad) {
@ -806,6 +811,7 @@ export default inject(
isLoadedEmptyPage, isLoadedEmptyPage,
hashSettings, hashSettings,
logout: auth.logout,
}; };
} }
)(withRouter(observer(Home))); )(withRouter(observer(Home)));

View File

@ -243,6 +243,10 @@
this.#isConnected = true; this.#isConnected = true;
} }
window.DocSpace.SDK.frames = window.DocSpace.SDK.frames || [];
window.DocSpace.SDK.frames[this.config.frameId] = this;
return this.#iframe; return this.#iframe;
} }
@ -274,6 +278,8 @@
window.removeEventListener("message", this.#onMessage, false); window.removeEventListener("message", this.#onMessage, false);
this.#isConnected = false; this.#isConnected = false;
delete window.DocSpace.SDK.frames[this.config.frameId];
this.#iframe.parentNode && this.#iframe.parentNode &&
this.#iframe.parentNode.replaceChild(target, this.#iframe); this.#iframe.parentNode.replaceChild(target, this.#iframe);
} }
@ -380,6 +386,4 @@
window.DocSpace = window.DocSpace || {}; window.DocSpace = window.DocSpace || {};
window.DocSpace.SDK = new DocSpace(config); window.DocSpace.SDK = new DocSpace(config);
window.DocSpace.SDK.initFrame();
})(); })();