Skip to content

Commit e81ff77

Browse files
committed
BUG: Do not reference script id
In the Colab notebook the id is never set for script for some reason. This leads to a bug in the script that prevents the screenshot from being hidden and incorrectly resizes the output area, forcing the user to scroll to find the viewer.
1 parent bf73082 commit e81ff77

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

itkwidgets/viewer.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,9 @@ async def create_screenshot(self):
119119
def update_screenshot(self, base64_image):
120120
html = HTML(
121121
f'''
122-
<img id=screenshot_{self.wid} src={base64_image}>
123-
<script id="script_{self.wid}" type="text/javascript">
124-
var container = document.getElementById("script_{self.wid}").parentNode;
122+
<img id="screenshot_{self.wid}" src={base64_image}>
123+
<script type="text/javascript">
125124
var image = document.getElementById("screenshot_{self.wid}");
126-
if (!image) {{
127-
image = document.createElement("img");
128-
image.id = "screenshot_{self.wid}";
129-
container.appendChild(image);
130-
}}
131125
image.src = "{base64_image}";
132126
var viewer = document.getElementById("{self.wid}");
133127
// Hide the static image if the Viewer is visible

0 commit comments

Comments
 (0)