File tree Expand file tree Collapse file tree
IPython/frontend/html/notebook/static/js Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -239,17 +239,24 @@ var IPython = (function (IPython) {
239239 }
240240 } ;
241241
242+ /**
243+ * Show/Hide CodeMirror LineNumber
244+ * @method show_line_numbers
245+ *
246+ * @param value {Bool} show (true), or hide (false) the line number in CodeMirror
247+ **/
248+ Cell . prototype . show_line_numbers = function ( value ) {
249+ this . code_mirror . setOption ( 'lineNumbers' , value ) ;
250+ this . code_mirror . refresh ( ) ;
251+ } ;
252+
242253 /**
243254 * Toggle CodeMirror LineNumber
244255 * @method toggle_line_numbers
245256 **/
246257 Cell . prototype . toggle_line_numbers = function ( ) {
247- if ( this . code_mirror . getOption ( 'lineNumbers' ) == false ) {
248- this . code_mirror . setOption ( 'lineNumbers' , true ) ;
249- } else {
250- this . code_mirror . setOption ( 'lineNumbers' , false ) ;
251- }
252- this . code_mirror . refresh ( ) ;
258+ var val = this . code_mirror . getOption ( 'lineNumbers' ) ;
259+ this . show_line_numbers ( ! val ) ;
253260 } ;
254261
255262 /**
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ var IPython = (function (IPython) {
4040 * {
4141 * label:'my button',
4242 * icon:'ui-icon-disk',
43- * callback:function(){alert('hoho'),
43+ * callback:function(){alert('hoho')} ,
4444 * id : 'my_button_id', // this is optional
4545 * },
4646 * {
You can’t perform that action at this time.
0 commit comments