@@ -144,27 +144,27 @@ function table(df) {
144144
145145}
146146
147- function notebook_json ( scope , md_scope ) {
147+ function notebook_json ( scope , md_scope ) {
148148
149149 var store = { }
150150
151151 for ( let key in scope ) {
152152
153153 let key_split = key . split ( "-" )
154154 let id = key_split [ 1 ]
155-
155+
156156 let type = key_split [ 0 ] . split ( "_" ) [ 1 ]
157157
158- if ( type == "text" ) {
158+ if ( type == "text" ) {
159159
160160 let md_out = md_scope [ `text-div_${ Number ( id ) } ` ]
161161 let text_output = $ ( `#cell-${ id } ` ) . html ( )
162162 store [ `cell-${ id } ` ] = {
163163 "out" : text_output ,
164- "md" : md_out
164+ "md" : md_out
165165 }
166166 }
167- else {
167+ else {
168168 let cell_content = scope [ key ] . getValue ( )
169169
170170 let cell_output = $ ( `#out_${ key } ` ) . html ( )
@@ -174,7 +174,7 @@ function notebook_json(scope,md_scope){
174174 "out" : cell_output
175175 }
176176 }
177-
177+
178178 }
179179
180180 store = JSON . stringify ( store ) ;
@@ -204,14 +204,14 @@ function LoadPackage(array, callback) {
204204 } ) ( ) ;
205205}
206206
207- function md_load ( id ) {
207+ function md_load ( id ) {
208208
209209 let md = `<div class="row" style="margin-top: 10px;" id="cell-${ id } "></div>`
210210
211211 return md ;
212212}
213213
214- function html_load ( new_id ) {
214+ function html_load ( new_id ) {
215215
216216 let html = `
217217 <div class="row" style="margin-top: 10px;" id="cell-${ new_id } ">
@@ -257,17 +257,17 @@ function html_load(new_id){
257257 <div class="col-md-2"></div>
258258 </div>
259259 `
260- return html ;
260+ return html ;
261261}
262262
263- function load_notebook ( json ) {
263+ function load_notebook ( json ) {
264+
265+
266+ for ( let key in json ) {
264267
265-
266- for ( let key in json ) {
267-
268268 let id = key . split ( "-" ) [ 1 ]
269269
270- if ( Object . prototype . hasOwnProperty . call ( json [ key ] , "in" ) ) {
270+ if ( Object . prototype . hasOwnProperty . call ( json [ key ] , "in" ) ) {
271271 let html = html_load ( id )
272272
273273 $ ( ".content" ) . append ( html )
@@ -289,44 +289,52 @@ function load_notebook(json){
289289 $ ( `#out_div-${ id } ` ) . html ( out ) ;
290290
291291 $ ( `#div-${ id } ` )
292- . mouseover ( function ( ) {
293- $ ( `#btn-actions-${ id } ` ) . show ( )
294- } )
295- . mouseout ( function ( ) {
296- $ ( `#btn-actions-${ id } ` ) . hide ( )
297- } ) ;
292+ . mouseover ( function ( ) {
293+ $ ( `#btn-actions-${ id } ` ) . show ( )
294+ } )
295+ . mouseout ( function ( ) {
296+ $ ( `#btn-actions-${ id } ` ) . hide ( )
297+ } ) ;
298+
299+ $ ( `#div-${ id } ` ) . keydown ( function ( e ) {
300+ if ( ( e . ctrlKey || e . metaKey ) && ( e . keyCode == 13 || e . keyCode == 10 ) ) {
301+ // document.getElementById("cell_spinner-1").style.display = "block"
302+ // document.getElementById("cell_num-1").style.display = "none"
303+ exec_cell ( `run_div-${ id } ` ) ;
304+
305+ }
306+ } ) ;
298307
299- } else {
308+ } else {
300309
301- let md = md_load ( id )
310+ let md = md_load ( id )
302311
303- $ ( ".content" ) . append ( md ) ;
312+ $ ( ".content" ) . append ( md ) ;
304313
305- let out = json [ key ] [ "out" ]
306- $ ( `#cell-${ id } ` ) . html ( out )
314+ let out = json [ key ] [ "out" ]
315+ $ ( `#cell-${ id } ` ) . html ( out )
307316
308- let md_out = json [ key ] [ "md" ]
309- // console.log(md_out)
310- md_texts [ `text-div_${ Number ( id ) } ` ] = md_out ;
317+ let md_out = json [ key ] [ "md" ]
318+ // console.log(md_out)
319+ md_texts [ `text-div_${ Number ( id ) } ` ] = md_out ;
311320
312- vars_in_scope [ `div_text-${ id } ` ] = ""
321+ vars_in_scope [ `div_text-${ id } ` ] = ""
313322
314- $ ( `textarea#text-box_${ id } ` ) . addClass ( "text-box" )
315- $ ( `textarea#text-box_${ id } ` ) . val ( md_out )
316- // update_text_box_size()
323+ $ ( `textarea#text-box_${ id } ` ) . addClass ( "text-box" )
324+ $ ( `textarea#text-box_${ id } ` ) . val ( md_out )
325+ // update_text_box_size()
317326
318- $ ( `#text-div_${ id } ` )
319- . mouseover ( function ( ) {
320- document . getElementById ( `btn-actions-${ id } ` ) . style . display = "block"
321- } )
322- . mouseout ( function ( ) {
323- document . getElementById ( `btn-actions-${ id } ` ) . style . display = "none"
324- } ) ;
327+ $ ( `#text-div_${ id } ` )
328+ . mouseover ( function ( ) {
329+ document . getElementById ( `btn-actions-${ id } ` ) . style . display = "block"
330+ } )
331+ . mouseout ( function ( ) {
332+ document . getElementById ( `btn-actions-${ id } ` ) . style . display = "none"
333+ } ) ;
325334 }
326335
327336 __code_cell_count = parseInt ( id )
328-
337+
329338 }
330339}
331340
332-
0 commit comments