Skip to content

Commit 312a23b

Browse files
committed
Revert "load jupyter widgets afterBody"
This reverts commit 793eb77.
1 parent 7c24e88 commit 312a23b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/core/jupyter/widgets.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,30 +98,31 @@ export function includesForJupyterWidgetDependencies(
9898
}
9999

100100
// write required dependencies into head
101-
const afterBody: string[] = [];
101+
const head: string[] = [];
102102
if (haveJavascriptWidgets || haveJupyterWidgets) {
103-
afterBody.push(
103+
head.push(
104104
'<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" integrity="sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==" crossorigin="anonymous"></script>',
105105
);
106-
afterBody.push(
106+
head.push(
107107
'<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>',
108108
);
109-
afterBody.push(
109+
head.push(
110110
"<script type=\"application/javascript\">define('jquery', [],function() {return window.jQuery;})</script>",
111111
);
112112
}
113113

114114
// html libraries (e.g. plotly)
115-
afterBody.push(...htmlLibraries);
115+
head.push(...htmlLibraries);
116116

117117
// jupyter widget runtime
118118
if (haveJupyterWidgets) {
119-
afterBody.push(
119+
head.push(
120120
'<script src="https://unpkg.com/@jupyter-widgets/html-manager@*/dist/embed-amd.js" crossorigin="anonymous"></script>',
121121
);
122122
}
123123

124124
// write jupyter widget state after body if it exists
125+
const afterBody: string[] = [];
125126
if (haveJupyterWidgets && widgetsState) {
126127
afterBody.push(`<script type=${kApplicationJupyterWidgetState}>`);
127128
afterBody.push(
@@ -143,6 +144,9 @@ export function includesForJupyterWidgetDependencies(
143144
inHeader: "",
144145
afterBody: "",
145146
};
147+
if (head.length > 0) {
148+
result.inHeader = widgetTempFile(head);
149+
}
146150
if (afterBody.length > 0) {
147151
result.afterBody = widgetTempFile(afterBody);
148152
}

0 commit comments

Comments
 (0)