@@ -8,6 +8,10 @@ const editor = CodeMirror(document.getElementById('div-1'), {
88 autoCloseBrackets : true
99} ) ;
1010
11+ //run first cell on double click
12+ $ ( `#div-1` ) . dblclick ( function ( ) {
13+ exec_cell ( `run_div-1` ) ;
14+ } ) ;
1115
1216var md = new Remarkable ( )
1317//Global Params
@@ -139,10 +143,13 @@ function add_new_code_cell(c_id, where) {
139143 tabSize : 2 ,
140144 mode : 'javascript' ,
141145 theme : 'monokai' ,
142- value : ''
146+ value : '' ,
147+ extraKeys : { "Ctrl-Space" : "autocomplete" } ,
148+ autoCloseBrackets : true
143149 } ) ;
144150 vars_in_scope [ `div-${ new_id } ` ] = editor
145151
152+ //show action buttons on hover
146153 $ ( `#div-${ new_id } ` )
147154 . mouseover ( function ( ) {
148155 $ ( `#btn-actions-${ new_id } ` ) . show ( )
@@ -151,6 +158,12 @@ function add_new_code_cell(c_id, where) {
151158 $ ( `#btn-actions-${ new_id } ` ) . hide ( )
152159 } ) ;
153160
161+
162+ //run cell on double click
163+ $ ( `#div-${ new_id } ` ) . dblclick ( function ( ) {
164+ exec_cell ( `run_div-${ new_id } ` ) ;
165+ } ) ;
166+
154167}
155168
156169function add_new_text_cell ( c_id , where ) {
@@ -249,6 +262,8 @@ function delete_cell(id) {
249262
250263
251264$ ( document ) . on ( "click" , "button.run" , function ( ) {
265+ console . log ( this . id ) ;
266+
252267 if ( this . id . split ( "_" ) . includes ( "md" ) ) {
253268 let id = this . id . split ( "-" ) [ 1 ]
254269 let val = document . getElementById ( `text-box_${ id } ` ) . value
@@ -258,6 +273,7 @@ $(document).on("click", "button.run", function () {
258273 }
259274} )
260275
276+
261277$ ( document ) . on ( "click" , "button.del" , function ( ) {
262278 let id = this . id . split ( "_" ) [ 1 ]
263279 delete_cell ( id )
0 commit comments