1
+ <!DOCTYPE html> < html lang ="en ">
2
+ <!--
3
+ This file is auto-generated from "sanity dev".
4
+ Modifications to this file are automatically discarded.
5
+ -->
6
+ < head > < meta charSet ="utf-8 "/> < meta name ="viewport " content ="width=device-width, initial-scale=1, viewport-fit=cover "/> < meta name ="robots " content ="noindex "/> < meta name ="referrer " content ="same-origin "/> < link rel ="icon " href ="/static/favicon.ico " sizes ="any "/> < link rel ="icon " href ="/static/favicon.svg " type ="image/svg+xml "/> < link rel ="apple-touch-icon " href ="/static/apple-touch-icon.png "/> < link rel ="manifest " href ="/static/manifest.webmanifest "/> < title > Sanity Studio</ title > < script >
7
+ ; ( function ( ) {
8
+ var _caughtErrors = [ ]
9
+
10
+ var errorChannel = ( function ( ) {
11
+ var subscribers = [ ]
12
+
13
+ function publish ( msg ) {
14
+ for ( var i = 0 ; i < subscribers . length ; i += 1 ) {
15
+ subscribers [ i ] ( msg )
16
+ }
17
+ }
18
+
19
+ function subscribe ( subscriber ) {
20
+ subscribers . push ( subscriber )
21
+
22
+ return function ( ) {
23
+ var idx = subscribers . indexOf ( subscriber )
24
+
25
+ if ( idx > - 1 ) {
26
+ subscribers . splice ( idx , 1 )
27
+ }
28
+ }
29
+ }
30
+
31
+ return { publish, subscribe, subscribers}
32
+ } ) ( )
33
+
34
+ // NOTE: Store the error channel instance in the global scope so that the Studio application can
35
+ // access it and subscribe to errors.
36
+ window . __sanityErrorChannel = {
37
+ subscribe : errorChannel . subscribe ,
38
+ }
39
+
40
+ function _nextTick ( callback ) {
41
+ setTimeout ( callback , 0 )
42
+ }
43
+
44
+ function _handleError ( error , params ) {
45
+ _nextTick ( function ( ) {
46
+ // - If there are error channel subscribers, then we notify them (no console error).
47
+ // - If there are no subscribers, then we log the error to the console and render the error overlay.
48
+ if ( errorChannel . subscribers . length ) {
49
+ errorChannel . publish ( { error, params} )
50
+ } else {
51
+ console . error ( error )
52
+
53
+ _renderErrorOverlay ( error , params )
54
+ }
55
+ } )
56
+ }
57
+
58
+ var ERROR_BOX_STYLE = [
59
+ 'background: #fff' ,
60
+ 'border-radius: 6px' ,
61
+ 'box-sizing: border-box' ,
62
+ 'color: #121923' ,
63
+ 'flex: 1' ,
64
+ "font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue','Liberation Sans',Helvetica,Arial,system-ui,sans-serif" ,
65
+ 'font-size: 16px' ,
66
+ 'line-height: 21px' ,
67
+ 'margin: 0 auto' ,
68
+ 'max-width: 960px' ,
69
+ 'overflow: auto' ,
70
+ 'padding: 20px' ,
71
+ 'width: 100%' ,
72
+ ] . join ( ';' )
73
+
74
+ var ERROR_CODE_STYLE = [
75
+ 'color: #972E2A' ,
76
+ "font-family: -apple-system-ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace" ,
77
+ 'font-size: 13px' ,
78
+ 'line-height: 17px' ,
79
+ 'margin: 0' ,
80
+ ] . join ( ';' )
81
+
82
+ function _renderErrorOverlay ( error , params ) {
83
+ var errorElement = document . querySelector ( '#__sanityError' ) || document . createElement ( 'div' )
84
+ var colno = params . event . colno
85
+ var lineno = params . event . lineno
86
+ var filename = params . event . filename
87
+
88
+ errorElement . id = '__sanityError'
89
+ errorElement . innerHTML = [
90
+ '<div style="' + ERROR_BOX_STYLE + '">' ,
91
+ '<div style="font-weight: 700;">Uncaught error: ' + error . message + '</div>' ,
92
+ '<div style="color: #515E72; font-size: 13px; line-height: 17px; margin: 10px 0;">' +
93
+ filename +
94
+ ':' +
95
+ lineno +
96
+ ':' +
97
+ colno +
98
+ '</div>' ,
99
+ '<pre style="' + ERROR_CODE_STYLE + '">' + error . stack + '</pre>' ,
100
+ '</div>' ,
101
+ ] . join ( '' )
102
+
103
+ errorElement . style . position = 'fixed'
104
+ errorElement . style . zIndex = 1000000
105
+ errorElement . style . top = 0
106
+ errorElement . style . left = 0
107
+ errorElement . style . right = 0
108
+ errorElement . style . bottom = 0
109
+ errorElement . style . padding = '20px'
110
+ errorElement . style . background = 'rgba(16,17,18,0.66)'
111
+ errorElement . style . display = 'flex'
112
+ errorElement . style . alignItems = 'center'
113
+ errorElement . style . justifyContent = 'center'
114
+
115
+ document . body . appendChild ( errorElement )
116
+ }
117
+
118
+ // NOTE:
119
+ // Yes – we're attaching 2 error listeners below 👀
120
+ // This is because React makes the same error throw twice (in development mode).
121
+ // See: https://github.com/facebook/react/issues/10384
122
+
123
+ // Error listener #1
124
+ window . onerror = function ( event , source , lineno , colno , error ) {
125
+ _nextTick ( function ( ) {
126
+ if ( _caughtErrors . indexOf ( error ) !== - 1 ) return
127
+
128
+ _caughtErrors . push ( error )
129
+
130
+ _handleError ( error , {
131
+ event,
132
+ lineno,
133
+ colno,
134
+ source,
135
+ } )
136
+
137
+ _nextTick ( function ( ) {
138
+ var idx = _caughtErrors . indexOf ( error )
139
+
140
+ if ( idx > - 1 ) _caughtErrors . splice ( idx , 1 )
141
+ } )
142
+ } )
143
+
144
+ // IMPORTANT: this callback must return `true` to prevent the error from being rendered in
145
+ // the browser’s console.
146
+ return true
147
+ }
148
+
149
+ // Error listener #2
150
+ window . addEventListener ( 'error' , function ( event ) {
151
+ if ( _caughtErrors . indexOf ( event . error ) !== - 1 ) return true
152
+
153
+ _caughtErrors . push ( event . error )
154
+
155
+ _handleError ( event . error , {
156
+ event,
157
+ lineno : event . lineno ,
158
+ colno : event . colno ,
159
+ } )
160
+
161
+ _nextTick ( function ( ) {
162
+ _nextTick ( function ( ) {
163
+ var idx = _caughtErrors . indexOf ( event . error )
164
+
165
+ if ( idx > - 1 ) _caughtErrors . splice ( idx , 1 )
166
+ } )
167
+ } )
168
+
169
+ return true
170
+ } )
171
+ } ) ( )
172
+ </ script > < style >
173
+ html {
174
+ background-color : # f1f3f6 ;
175
+ }
176
+ html ,
177
+ body ,
178
+ # sanity {
179
+ height : 100% ;
180
+ }
181
+ body {
182
+ margin : 0 ;
183
+ -webkit-font-smoothing : antialiased;
184
+ }
185
+ </ style > </ head > < body > < div id ="sanity "> </ div > < script type ="module " src ="/.sanity\runtime\app.js "> </ script > < noscript > < div class ="sanity-app-no-js__root "> < div class ="sanity-app-no-js__content "> < style type ="text/css ">
186
+ .sanity-app-no-js__root {
187
+ position : absolute;
188
+ top : 0 ;
189
+ right : 0 ;
190
+ left : 0 ;
191
+ bottom : 0 ;
192
+ background : # fff ;
193
+ }
194
+
195
+ .sanity-app-no-js__content {
196
+ position : absolute;
197
+ top : 50% ;
198
+ left : 50% ;
199
+ transform : translate (-50% , -50% );
200
+ text-align : center;
201
+ font-family : helvetica, arial, sans-serif;
202
+ }
203
+ </ style > < h1 > JavaScript disabled</ h1 > < p > Please < a href ="https://www.enable-javascript.com/ "> enable JavaScript</ a > in your browser and reload the page to proceed.</ p > </ div > </ div > </ noscript > </ body > </ html >
0 commit comments