Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit 6ddf9eb

Browse files
author
Daniel Obi
committed
Ensuring extension loads in an iframe within the AWS console context
1 parent c261013 commit 6ddf9eb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ const activate = (
4747
// Instead we just have higher specificity and forget about the override; our theme will kick-in since it's all-in-one.
4848
// We can rework this later after release once we split this into multiple extensions.
4949
const body = document.querySelector('body');
50+
51+
// Ensuring extension loads in an iframe within the AWS console context; otherwise do early return
52+
if (window.location === window.parent.location) {
53+
body.innerHTML = '';
54+
return;
55+
}
56+
5057
body?.setAttribute('id', 'glue-base');
5158
body?.classList.add('aws-fake-loader');
5259

@@ -81,7 +88,7 @@ const activate = (
8188
*/
8289
const addBtnText = 'Save the notebook contents and create checkpoint';
8390
const addBtnSelector = `[title="${addBtnText}"]`;
84-
document.querySelector(addBtnSelector).parentElement.remove();
91+
document.querySelector(addBtnSelector)?.parentElement?.remove();
8592

8693
const buttonContainer = document.querySelector(
8794
'.lm-Widget.p-Widget.jp-Toolbar-spacer.jp-Toolbar-item'

0 commit comments

Comments
 (0)