Skip to content

Commit a9e0aff

Browse files
committed
fix: widget cannot resize in new Jupyter versions
1 parent 34dbb0f commit a9e0aff

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/backend/src/anywidget/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ function makeDatabaseConnector(model: AnyModel<Model>) {
5454
const initialize: Initialize<Model> = (view) => {};
5555

5656
const render: Render<Model> = (view) => {
57-
view.el.classList.add("mosaic-widget");
58-
5957
const coordinator = new Coordinator();
6058
coordinator.databaseConnector(makeDatabaseConnector(view.model));
6159

@@ -83,12 +81,14 @@ const render: Render<Model> = (view) => {
8381
}
8482

8583
// Configure view style
86-
view.el.style.height = "650px";
87-
view.el.style.resize = "vertical";
88-
view.el.style.overflow = "auto";
84+
let container = document.createElement("div");
85+
container.style.height = "650px";
86+
container.style.resize = "vertical";
87+
container.style.overflow = "auto";
88+
view.el.replaceChildren(container);
8989

9090
// Create the component
91-
const component = new EmbeddingAtlas(view.el, getProps());
91+
const component = new EmbeddingAtlas(container, getProps());
9292

9393
return () => {
9494
component.destroy();

0 commit comments

Comments
 (0)