aboutsummaryrefslogtreecommitdiff
path: root/development/jupyter-notebook/nbclassic-0.4.6.patch
blob: ac3e8fa3a3c0e17e481939a5f4bced88737da327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From ab71610669e7548f2e9050f98da80cf1eba675ae Mon Sep 17 00:00:00 2001
From: Eric Charles <eric@datalayer.io>
Date: Sun, 16 Oct 2022 11:36:45 +0200
Subject: [PATCH] Ensure custom preload is correctly handled

---
 docs/environment.yml         |  2 +-
 notebook/templates/page.html | 12 ++++++++++++
 setup.py                     |  2 +-
 tools/build-main.js          |  1 +
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/docs/environment.yml b/docs/environment.yml
index 9f2872ecc3..f3b152ddbd 100644
--- a/docs/environment.yml
+++ b/docs/environment.yml
@@ -13,7 +13,7 @@ dependencies:
 - sphinx
 - terminado
 - myst-parser
-- nbclassic==0.4.5
+- nbclassic==0.4.6
 - pip:
   - nbsphinx
   - Send2Trash
diff --git a/notebook/templates/page.html b/notebook/templates/page.html
index 927694e937..fb5d642f4e 100644
--- a/notebook/templates/page.html
+++ b/notebook/templates/page.html
@@ -98,6 +98,18 @@
           }
       })
 
+      // error-catching custom-preload.js shim.
+      define("custom-preload", function (require, exports, module) {
+          try {
+              var custom = require('custom/custom-preload');
+              console.debug('loaded custom-preload.js');
+              return custom;
+          } catch (e) {
+              console.error("error loading custom-preload.js", e);
+              return {};
+          }
+      })
+
     document.nbjs_translations = {{ nbjs_translations|safe }};
     document.documentElement.lang = navigator.language.toLowerCase();
     </script>
diff --git a/setup.py b/setup.py
index 02cc702ca2..9579214b75 100755
--- a/setup.py
+++ b/setup.py
@@ -122,7 +122,7 @@
         'Send2Trash>=1.8.0',
         'terminado>=0.8.3',
         'prometheus_client',
-        'nbclassic==0.4.5',
+        'nbclassic==0.4.6',
     ],
     extras_require = {
         'test': ['pytest', 'coverage', 'requests', 'testpath',
diff --git a/tools/build-main.js b/tools/build-main.js
index 517186476a..0dcccaee64 100644
--- a/tools/build-main.js
+++ b/tools/build-main.js
@@ -60,6 +60,7 @@ var rjs_config = {
 
   exclude: [
     "custom/custom",
+    "custom/custom-preload",
   ]
 };