Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"size-limit": [
{
"path": "dist/tsembed.es.js",
"limit": "34 kB"
"limit": "50 kB"
}
],
"scripts": {
Expand Down
25 changes: 23 additions & 2 deletions src/embed/ts-embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class TsEmbed {
this.hostEventClient.setIframeElement(iFrame);
}

protected viewConfig: ViewConfig & { visibleTabs?: string[], hiddenTabs?: string[], showAlerts?: boolean };
protected viewConfig: ViewConfig & { visibleTabs?: string[], hiddenTabs?: string[], showAlerts?: boolean, fullHeight?: boolean };

protected embedConfig: EmbedConfig;

Expand Down Expand Up @@ -187,6 +187,7 @@ export class TsEmbed {

protected isReadyForRenderPromise;

private static activeInstances = new Set<TsEmbed>();
/**
* Handler for fullscreen change events
*/
Expand Down Expand Up @@ -217,6 +218,7 @@ export class TsEmbed {
this.thoughtSpotV2Base = getV2BasePath(embedConfig);
this.shouldEncodeUrlQueryParams = embedConfig.shouldEncodeUrlQueryParams;
});
TsEmbed.activeInstances.add(this);
}

/**
Expand Down Expand Up @@ -1121,8 +1123,26 @@ export class TsEmbed {
* Sets the height of the iframe
* @param height The height in pixels
*/
protected setIFrameHeight(height: number | string): void {
protected setIFrameHeight(height: number | string) {
this.iFrame.style.height = getCssDimension(height);

if (this.viewConfig.fullHeight && this.isPreRendered) {
// Fix #1: wrapper height matches iframe
if (this.preRenderWrapper) {
this.preRenderWrapper.style.height = getCssDimension(height);
}
// Fix #2 + #3: container takes up space in normal flow
if (this.el) {
(this.el as HTMLElement).style.height = getCssDimension(height);
}
// Fix stale top/left on ALL wrappers — growing this embed
// shifts every subsequent wrapper's position on the page
TsEmbed.activeInstances.forEach(instance => {
if (instance.isPreRenderAvailable()) {
instance.syncPreRenderStyle();
}
});
}
}

/**
Expand Down Expand Up @@ -1615,6 +1635,7 @@ export class TsEmbed {
try {
this.removeFullscreenChangeHandler();
this.unsubscribeToEvents();
TsEmbed.activeInstances.delete(this);
if (!this.isRendered) {
return;
}
Expand Down
Loading